of static method
ExtendedNavigatorState<RouterBase?> ?
of(
- BuildContext context, {
- bool rootRouter = false,
- bool nullOk = false,
Implementation
static ExtendedNavigatorState? of(
BuildContext context, {
bool rootRouter = false,
bool nullOk = false,
}) {
final ExtendedNavigatorState? router = rootRouter
? context.findRootAncestorStateOfType<ExtendedNavigatorState>()
: context.findAncestorStateOfType<ExtendedNavigatorState>();
assert(() {
if (router == null && !nullOk) {
throw FlutterError(
'ExtendedNavigator operation requested with a context that does not include an ExtendedNavigator.\n'
'The context used to push or pop routes from the ExtendedNavigator must be that of a '
'widget that is a descendant of an ExtendedNavigator widget.');
}
return true;
}());
return router;
}