initScopeAsync method
Future<GetIt>
initScopeAsync(
- String name, {
- required Future<
void> init(- GetItHelper gh
- ScopeDisposeFunc? dispose,
a helper method to push a new scope and init it's dependencies
asynchronously inside of GetIt
Implementation
Future<GetIt> initScopeAsync(String name,
{required Future<void> Function(GetItHelper gh) init,
ScopeDisposeFunc? dispose}) {
final completer = Completer<GetIt>();
getIt.pushNewScope(
scopeName: name,
init: (getIt) async {
await init(this);
completer.complete(getIt);
},
dispose: dispose,
);
return completer.future;
}