of static method
Looks up and returns the scoped StackRouter
if watch is true dependent widget will watch changes of this scope otherwise it would just read it
throws an error if it does not find it
Implementation
static StackRouter of(BuildContext context, {bool watch = false}) {
var scope = StackRouterScope.of(context, watch: watch);
assert(() {
if (scope == null) {
throw FlutterError(
'AutoRouter operation requested with a context that does not include an AutoRouter.\n'
'The context used to retrieve the Router must be that of a widget that '
'is a descendant of an AutoRouter widget.');
}
return true;
}());
return scope!.controller;
}