of static method
Finds the nearest ZenScope above the given context.
Returns the scope or throws an exception if none is found.
Implementation
static ZenScope of(BuildContext context) {
final _ZenScopeProvider? provider =
context.dependOnInheritedWidgetOfExactType<_ZenScopeProvider>();
if (provider == null) {
throw Exception('No ZenScope found in the widget tree. '
'Make sure to wrap your widget with a ZenScopeWidget.');
}
return provider.scope;
}