of static method
The wizard scope from the closest instance of this class that encloses the
given context
.
If no instance of this class encloses the given context, will cause an
assert in debug mode, and throw an exception in release mode. To return
null
if there is no wizard scope, use maybeOf instead.
See also:
Implementation
static WizardScopeState of(BuildContext context, {bool root = false}) {
final scope = maybeOf(context, root: root);
assert(() {
if (scope == null) {
throw FlutterError(
'Wizard operation requested with a context that does not include a Wizard.\n'
'The context passed to Wizard.of(context) must belong to a widget that is a descendant of a Wizard widget.',
);
}
return true;
}());
return scope!;
}