controller property
T
get
controller
Implementation
T get controller {
final controller = _ZenViewRegistry.get<T>();
if (controller != null) {
return controller;
}
// Fallback to DI lookup for edge cases
final scope = this.scope;
if (scope != null) {
final foundController = scope.find<T>(tag: tag);
if (foundController != null) {
return foundController;
}
}
final globalController = Zen.findOrNull<T>(tag: tag);
if (globalController != null) {
return globalController;
}
throw Exception(
'Controller $T not available. Access from build method only.');
}