registerFactory<T> method

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

registers a type so that a new instance will be created on each call of get on that type T type to register fun factory funtion for this type

Implementation

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