regionOf static method
The region of the Regionalizations widget for the widget tree that
corresponds to BuildContext context
.
If no Regionalizations widget is in scope then the Regionalizations.regionOf method will throw an exception.
Implementation
static Region regionOf(BuildContext context) {
final scope =
context.dependOnInheritedWidgetOfExactType<_RegionalizationsScope>();
assert(
scope != null,
'''
Requested the Region of a context that does not include a Regionalizations ancestor.
To request the Region, the context used to retrieve the Regionalizations widget must
be that of a widget that is a descendant of a Regionalizations widget.
''',
);
return scope!.state.region;
}