find<T> static method

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

Find a dependency in root scope (throws if not found)

Implementation

static T find<T>({String? tag}) {
  final result = rootScope.find<T>(tag: tag);
  if (result == null) {
    throw ZenDependencyNotFoundException(
      typeName: T.toString(),
      scopeName: 'RootScope',
      tag: tag,
    );
  }

  // Auto-initialize ZenService on first access
  if (result is ZenService && !result.isInitialized) {
    result.ensureInitialized();
  }

  return result;
}