registerInstance<T> method
Register an instance
Implementation
void registerInstance<T>(T instance, String? tag) {
// Store the instance by its exact generic type T
_instances.putIfAbsent(T, () => {});
_instances[T]![tag] = instance;
// Also store by runtime type if it's different from T
final runtimeType = instance.runtimeType;
if (runtimeType != T) {
_instances.putIfAbsent(runtimeType, () => {});
_instances[runtimeType]![tag] = instance;
}
}