findRequired<T> method

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

Find a dependency (throws if not found)

Implementation

T findRequired<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 scope: $name');
  }
  return result;
}