of static method

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

Implementation

static StackRouter of(BuildContext context, {bool watch = false}) {
  var scope = StackRouterScope.of(context, watch: watch);
  assert(() {
    if (scope == null) {
      throw FlutterError(
          'NestedRouter operation requested with a context that does not include an NestedRouter.\n'
          'The context used to retrieve the Router must be that of a widget that '
          'is a descendant of an NestedRouter widget.');
    }
    return true;
  }());
  return scope!.controller;
}