registerSingleton<T> method
- T instance,
- {String instanceName,
- bool signalsReady: false}
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
If signalsReady
is set to true
it means that the ready
property cannot emit a ready event until this
registration was signalled ready
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
Implementation
void registerSingleton<T>(T instance,
{String instanceName, bool signalsReady = false}) {
_register<T>(
type: _ServiceFactoryType.constant,
instanceName: instanceName,
instance: instance,
signalsReady: signalsReady);
}