registerLazySingleton<T> method

void registerLazySingleton <T>(FactoryFunc<T> func)

registers a type as Singleton by passing a factory function that will be called on the first call of get on that type T type to register fun factory funtion for this type

Implementation

void registerLazySingleton<T>(FactoryFunc<T> func) {
  assert(allowReassignment || !_factories.containsKey(T),
      "Type ${T.toString()} is already registered");
  _factories[T] = new _ServiceFactory<T>(_ServiceFactoryType.lazy,
      creationFunction: func);
}