controller<T extends ZenController> method

T controller<T extends ZenController>({
  1. String? tag,
})

Implementation

T controller<T extends ZenController>({String? tag}) {
  // Scope-based lookup — pure widget-tree resolution, fully isolated.
  final scope = mounted ? zenScope : null;
  if (scope != null) {
    final found = scope.find<T>(tag: tag);
    if (found != null) return found;
  }

  throw ZenControllerNotFoundException(
    typeName: T.toString(),
    customMessage: 'No $T found in the widget tree.',
  );
}