addSingleton<T> abstract method Null safety

void addSingleton<T>(
  1. Function constructor,
  2. {String? tag,
  3. DisposeCallback<T>? onDispose,
  4. NotifierCallback<T>? notifier}
)

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);

Implementation

void addSingleton<T>(
  Function constructor, {
  String? tag,
  DisposeCallback<T>? onDispose,
  NotifierCallback<T>? notifier,
});