provideSingleton<T> function

void provideSingleton<T>(
  1. FactoryFunc<T> factory, {
  2. bool lazy = true,
})

Registers a singleton factory on the globalContainer.

When lazy is true, factory is invoked on the first call to inject; when false, it is evaluated immediately. The returned instance is reused for all subsequent calls.

provideSingleton<AuthStore>(() => AuthStore());

Implementation

void provideSingleton<T>(FactoryFunc<T> factory, {bool lazy = true}) =>
    globalContainer.provideSingleton<T>(factory, lazy: lazy);