getOrNull<T> static method
T?
getOrNull<T>()
Attempts to find the instance or create it; returns null if not found.
Implementation
static T? getOrNull<T>() {
if (_instances.containsKey(T)) {
return _instances[T] as T;
}
if (_factories.containsKey(T)) {
final instance = _factories[T]!();
return put<T>(instance);
}
return null;
}