lazySingleton<T> method

  1. @override
void lazySingleton<T>(
  1. dynamic factory(
    1. ContainerInterface
    )
)
override

Registers a lazy singleton instance.

Creates a singleton binding that defers instance creation until the first time it's resolved, improving startup performance.

T - The type to register as lazy singleton factory - Factory function that creates the instance

Implementation

@override
void lazySingleton<T>(dynamic Function(ContainerInterface) factory) {
  _bindings[T] = _Binding(factory, singleton: true, lazy: true);
}