Navigator Extension
Page helpers construct material_ui.MaterialPageRoute. Navigator and Route primitives remain shared Flutter types.
popPage
Request back navigation through Navigator.maybePop; PopScope may veto it. Use context.forcePopPage() for a direct Navigator.pop that bypasses the veto.
context.popPage();popRoot
To pop the root navigator, useful for dismissing dialogs.
context.popRoot();navigator
Get the NavigatorState of the current or root navigator.
var navState = context.navigator();
var rootNavState = context.navigator(rootNavigator: true);canPopPage
Check if the current route can be popped.
bool canPop = context.canPopPage;pushPage
To push a new page onto the navigation stack.
context.pushPage(MyNewPage());pushReplacementPage
To replace the current page with a new one.
context.pushReplacementPage(MyNewPage());pushPageAndClearStack
To push a page and remove all routes below it.
context.pushPageAndClearStack(MyNewPage());pushNamedRouteAndClearStack
To push a named route and remove all routes below it.
context.pushNamedRouteAndClearStack('/myNewPage');pushNamedRoute
To push a named route.
context.pushNamedRoute('/myNewPage');pushReplacementNamedRoute
To replace the current route with a named one.
context.pushReplacementNamedRoute('/myNewPage');popUntilNamed
To pop routes until a specific named route is reached.
context.popUntilNamed('/home');dismissAllPopups
To dismiss any active pop-up like dialogs, modal bottom sheets, or Cupertino modal popups.
context.dismissAllPopups();