ZenViewContextExtensions extension
Context extension for resolving a ZenController from within any widget.
Resolves strictly from the widget tree — no global registry involved. This makes it safe for any number of simultaneous instances.
Resolution order (most-specific first):
- Nearest ZenScope in the widget tree.
- Global Zen.findOrNull — root-scope / singleton registrations.
Prefer this over ZenViewExtension.controller for:
- Plain StatelessWidget components inside a ZenScopeWidget.
- Any widget that needs guaranteed per-widget-tree-position isolation.
final ctrl = context.controller<MyController>();
- on
Methods
-
controller<
T extends ZenController> ({String? tag}) → T -
Available on BuildContext, provided by the ZenViewContextExtensions extension