registerSingletonWithDependencies<T extends Object> abstract method
- FactoryFunc<
T> factoryFunc, { - String? instanceName,
- Iterable<
Type> ? dependsOn, - bool? signalsReady,
- DisposingFunc<
T> ? dispose,
registers a type as Singleton by passing an factory function of that type
that will be called on each call of get on that type
T
type to register
instanceName
if you provide a value here your instance gets registered with that
name instead of a type. This should only be necessary if you need to register more
than one instance of one type. Its highly not recommended
dependsOn
if this instance depends on other registered Singletons before it can be
initialized you can either orchestrate this manually using isReady() or pass a list of
the types that the instance depends on here. factoryFunc
won't get executed till this
types are ready. func
is called if signalsReady
is set to true
it means that the
future you can get from allReady()
cannot complete until this this instance was
signalled ready by calling signalsReady(instance)
.
Implementation
void registerSingletonWithDependencies<T extends Object>(
FactoryFunc<T> factoryFunc, {
String? instanceName,
Iterable<Type>? dependsOn,
bool? signalsReady,
DisposingFunc<T>? dispose,
});