get<T> method

T get<T>({
  1. String? tag,
})

Find a dependency and throw if not found

Implementation

T get<T>({String? tag}) {
  final result = find<T>(tag: tag);
  if (result == null) {
    throw Exception(
        'Dependency of type $T${tag != null ? ' with tag $tag' : ''} not found in test container');
  }
  return result;
}