findInScope<T> method

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

Finds a dependency in the current scope

Implementation

T findInScope<T>({String? tag}) {
  final scope = zenScope;
  if (scope == null) {
    throw ZenScopeNotFoundException(widgetType: 'ZenRoute');
  }
  final result = scope.find<T>(tag: tag);
  if (result == null) {
    throw ZenDependencyNotFoundException(
      typeName: T.toString(),
      scopeName: scope.name ?? 'UnnamedScope',
      tag: tag,
    );
  }
  return result;
}