registerSingleton<T> method

void registerSingleton <T>(T instance, [ String instanceName ])

registers a type as Singleton by passing an instance of that type that will be returned on each call of get on that type T type to register instanceName if you provide a value here your instance gets registered with that name instead of a type. This should only be nesseary if you need to register more than one instance of one type. Its highly not recommended

Implementation

void registerSingleton<T>(T instance, [String instanceName]) {
  _register<T>(
      type: _ServiceFactoryType.constant,
      instanceName: instanceName,
      instance: instance);
}