Reference

Navigation Verbs

Every verb on AdaptiveRouter, how it behaves in one and two columns, tab switching and exit confirmation.

All names and signatures match NavigatorState. routeName is a location. There is no non-named push(Route) — every page must be in the table so the URL can express it.

Verbs

CallBehavior
pushNamed Push onto the branch Navigator , or overlay the root if fullscreen / off-shell. Same-branch prefix extends the stack ( /mail → /mail/inbox/42 can slide in two panes). Same-branch non-prefix appends the leaf ( /mail/inbox/41 → /mail/inbox/42 yields [mail, inbox, 41, 42] ). Other branch: switch tab and rebuild that stack from the URL.
pushReplacementNamed Replace stack top. Same-level swap; the right pane updates in place.
pushNamedAndRemoveUntil Pop while the predicate is false, then pushNamed . (_) => false rebuilds from the URL (deep link, login return, reset tab).
popAndPushNamed pop then pushNamed.
pop Pop immediately. Does not call onExit . If a dialog / sheet / menu covers the top page, only that layer is closed.
maybePop Asks the top page's PopScope first, then the route's onExit . AppBar back, system back, browser back, and Escape use this. Context-free: it only handles the top pane plus root / shell popups that cover everything.
popFrom(context) Acts on the layer context lives in: inside a dialog / sheet it closes that; inside a page it closes the popup covering that page, or pops the page when it is the top page and uncovered. Does not call onExit .
maybePopFrom(context) Consultative popFrom : a popup gets its own PopScope ; a page gets PopScope → onExit .
popUntil Pop until the predicate is true, not past the branch root.
canPop Overlay present, or current branch depth > 1.

pushNamed returns a Future completed by pop(result).

Helpers

  • namedLocation(name, pathParameters:, queryParameters:) builds a location for the *Named verbs.
  • refresh() re-runs redirect after auth changes.

Switching tabs

Tab switches are not a Navigator verb. Use AdaptiveShellState.goBranch(index, {initialLocation}). Internally that is pushNamedAndRemoveUntil to the branch's last location (or initialLocation). Tapping the current tab with initialLocation: true returns to the branch root:

dart
if (index == shell.currentIndex) {
  shell.goBranch(index, initialLocation: true);
} else {
  shell.goBranch(index);
}

Confirm before exit

Put PopScope(canPop: false) in the shell builder (or a tab root page). System back then calls onPopInvokedWithResult(false) so you can show a dialog and SystemNavigator.pop().