registerNamedSingleton<T> method
Registers a named singleton.
Note that this is not related to type-based injections, and exists as a mechanism to enable injecting multiple instances of a type within the same container hierarchy.
Implementation
T registerNamedSingleton<T>(String name, T object) {
if (_namedSingletons.containsKey(name)) {
throw StateError('This container already has a singleton named "$name".');
}
_namedSingletons[name] = object;
return object;
}