getOrNull<T> static method

T? getOrNull<T>()

getOrNullT method.

Implementation

static T? getOrNull<T>() {
  /// Stores the =.
  final instance = _instances[T];

  /// if method.
  if (instance != null) {
    return instance as T;
  }

  /// Stores the =.
  final factory = _factories[T];

  /// if method.
  if (factory != null) {
    /// Stores the =.
    final newInstance = factory();
    return put<T>(newInstance);
  }

  return null;
}