provideSingleton<T> method
Registers a singleton factory for type T.
When lazy is true (the default), factory is evaluated on the first inject call
and the resulting instance is cached for all future resolutions. When lazy is false,
factory is executed immediately upon registration.
container.provideSingleton<DatabaseService>(() => DatabaseService(), lazy: true);
Implementation
void provideSingleton<T>(FactoryFunc<T> factory, {bool lazy = true}) {
_bindings[T] = _Binding<T>.singleton(factory, lazy: lazy);
}