mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-23 21:13:35 +00:00
refactor(structure): move benchmarks, scenarios, adapters, utils to dedicated folders; update imports/project layout
This commit is contained in:
20
benchmark_cherrypick/lib/scenarios/async_chain_module.dart
Normal file
20
benchmark_cherrypick/lib/scenarios/async_chain_module.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:cherrypick/cherrypick.dart';
|
||||
|
||||
class AsyncA {}
|
||||
class AsyncB {
|
||||
final AsyncA a;
|
||||
AsyncB(this.a);
|
||||
}
|
||||
class AsyncC {
|
||||
final AsyncB b;
|
||||
AsyncC(this.b);
|
||||
}
|
||||
|
||||
class AsyncChainModule extends Module {
|
||||
@override
|
||||
void builder(Scope currentScope) {
|
||||
bind<AsyncA>().toProvideAsync(() async => AsyncA()).singleton();
|
||||
bind<AsyncB>().toProvideAsync(() async => AsyncB(await currentScope.resolveAsync<AsyncA>())).singleton();
|
||||
bind<AsyncC>().toProvideAsync(() async => AsyncC(await currentScope.resolveAsync<AsyncB>())).singleton();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user