registerSingleton<T extends Object> abstract method
T
registerSingleton<T extends Object>(
- T instance, {
- String? instanceName,
- bool? signalsReady,
- DisposingFunc<
T> ? dispose,
registers a type as Singleton by passing an instance
of that type
that will be returned on each call of get on that type
T
type to register
The newly registered instance will also be returned.
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.
If signalsReady
is set to true
it means that the future you can get from allReady()
cannot complete until this instance was signalled ready by calling
signalsReady(instance)
.
Implementation
T registerSingleton<T extends Object>(
T instance, {
String? instanceName,
bool? signalsReady,
DisposingFunc<T>? dispose,
});