get<T> static method

T? get<T>()

Return an instanced object

Implementation

static T? get<T>() {
  if (_mocks.containsKey(T)) {
    return _mocks.remove(T) as T?;
  }

  if (!_objects.containsKey(T)) {
    final instance = Inject.instance<T>();

    _objects.putIfAbsent(T, () => instance);

    return instance;
  }

  return _objects[T] as T?;
}