get<E> method

  1. @override
E? get<E>([
  1. GetFromSubStorage<E>? func
])
inherited

Obtains the instance of given type E.

If there is no instance for type, then null will be returned

Implementation

@override
E? get<E>([GetFromSubStorage<E>? func]) {
  Object? res = _map[E];
  if (res == null && _subStorage.isNotEmpty) {
    for (final storage in _subStorage) {
      res = func != null ? func.call(storage) : storage.get<E>();
      if (res != null) return res as E?;
    }
  }

  return res as E?;
}