registerSingletonWithDependencies<T extends Object> method
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 initilaized
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,
Set<String>? registerFor,
}) {
if (_canRegister(registerFor)) {
locator.registerSingletonWithDependencies<T>(
factoryFunc,
instanceName: instanceName,
dependsOn: dependsOn,
signalsReady: signalsReady,
dispose: dispose,
);
}
}