controller<T extends ZenController> method
T
controller<
T extends ZenController>({ - String? tag,
})
Implementation
T controller<T extends ZenController>({String? tag}) {
// 1. 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;
}
// 2. Global DI fallback
final global = Zen.findOrNull<T>(tag: tag);
if (global != null) return global;
throw ZenControllerNotFoundException(typeName: T.toString());
}