addSingleton<T> method
void
addSingleton<T>(})
inherited
Register a Singleton instance.
It will generate a single instance for the duration of
the application, or until manually removed.
The object will be started as soon as it is registered.
injector.addSingleton(MyController.new);
When [key] is provided this instance only can be found by key
Implementation
@override
void addSingleton<T>(
Function constructor, {
BindConfig<T>? config,
String? key,
}) {
_add<T>(
constructor,
type: BindType.singleton,
config: config,
key: key,
);
}