singleton<T extends Object> static method

Bind<T> singleton<T extends Object>(
  1. T inject(
    1. Injector i
    ), {
  2. bool export = false,
  3. void onDispose(
    1. T value
    )?,
  4. dynamic selector(
    1. T value
    )?,
})

Bind a 'Singleton' class. Built together with the module. The instance will always be the same.

Implementation

static Bind<T> singleton<T extends Object>(T Function(Injector i) inject,
    {bool export = false,
    void Function(T value)? onDispose,
    dynamic Function(T value)? selector}) {
  return Bind<T>(inject,
      isSingleton: true,
      isLazy: false,
      export: export,
      onDispose: onDispose,
      selector: selector);
}