get method

  1. @override
FutureOr<ObjectHolder<T>> get([
  1. List<ArgumentValue>? args
])
override

Retrieves the single object instance or throws if none or more than one found.

Implementation

@override
FutureOr<ObjectHolder<T>> get([List<ArgumentValue>? args]) async {
  final it = stream().iterator();
  if (!it.moveNext()) {
    throw NoSuchPodDefinitionException.byType(Class<Object>());
  }

  final result = it.current;
  if (it.moveNext()) {
    throw NoUniquePodDefinitionException.byTypeWithCount(Class<Object>(), 2, "$T has more than 1 matching pod");
  }

  return result;
}