registerLazySingleton<T> method

void registerLazySingleton<T>(
  1. T serviceFactory()
)

In registerLazySingleton method, DI container creates a new instance of the registered dependency when it's first requested Subsequent requests will return the same instance that was initially created at the first request

Implementation

void registerLazySingleton<T>(T Function() serviceFactory) {
  _services[T] = LazySingleton<T>(serviceFactory);
}