of static method

TabsRouter of(
  1. BuildContext context, {
  2. bool watch = false,
})

Looks up and returns the scoped controller

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 TabsRouter of(BuildContext context, {bool watch = false}) {
  var scope = TabsRouterScope.of(context, watch: watch);
  assert(() {
    if (scope == null) {
      throw FlutterError(
          'AutoTabsRouter operation requested with a context that does not include an AutoTabsRouter.\n'
          'The context used to retrieve the AutoTabsRouter must be that of a widget that '
          'is a descendant of an AutoTabsRouter widget.');
    }
    return true;
  }());
  return scope!.controller;
}