registerSingleton<T> method

void registerSingleton <T>(T instance)

registers a type as Singleton by passing an instance that will be returned on each call of get on that type T type to register fun factory funtion for this type

Implementation

void registerSingleton<T>(T instance) {
  assert(allowReassignment || !_factories.containsKey(T),
      "Type ${T.toString()} is already registered");
  _factories[T] = new _ServiceFactory<T>(_ServiceFactoryType.constant,
      instance: instance);
}