read static method
Reads the nearest ISpectScopeModel from the widget tree.
This is the canonical way to access the scope model; prefer it over
ISpectScopeController.of(context), which is deprecated.
Throws an ISpectScopeNotFoundError if no ISpectScopeController is an
ancestor - ensure ISpectBuilder wraps the widget that uses this context.
Implementation
static ISpectScopeModel read(BuildContext context) {
final inherited = context
.dependOnInheritedWidgetOfExactType<ISpectScopeController>();
if (inherited == null || inherited.notifier == null) {
throw ISpectScopeNotFoundError();
}
return inherited.notifier!;
}