of static method

StackRouterScope? 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

returns null if it does not find it

Implementation

static StackRouterScope? of(BuildContext context, {bool watch = false}) {
  if (watch) {
    return context.dependOnInheritedWidgetOfExactType<StackRouterScope>();
  }
  return context.findAncestorWidgetOfExactType<StackRouterScope>();
}