NavigatorState class

State for Navigator, providing route stack management.

Access this via Navigator.of(context) to push, pop, and manage routes.

Inheritance

Constructors

Properties

context BuildContext
The build context for this state.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
mounted bool
Whether this state is currently mounted in the element tree.
no setterinherited
routes List<Route>
The current route stack (read-only).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
widget Navigator
The current configuration for this state.
getter/setter pairinherited

Methods

build(BuildContext context) Widget
Builds the widget subtree for this state.
override
canPop() bool
Whether the navigator can pop the current route.
didUpdateWidget(covariant Navigator oldWidget) Cmd?
Called when the widget configuration changes.
inherited
dispose() → void
Called when this state is permanently removed from the tree.
override
handleInit() Cmd?
Called once when the widget tree is first mounted.
inherited
handleIntercept(Msg msg) Cmd?
Called before children during message dispatch.
override
handleUpdate(Msg msg) Cmd?
Called after children during message dispatch.
inherited
initState() → void
Called when the state is inserted into the tree.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pop<T>([T? result]) → void
Pops the current route, optionally returning a result.
popUntil(bool predicate(Route)) → void
Pops routes until predicate returns true for a route.
push<T>(Route<T> route) Future<T?>
Pushes a route onto the navigation stack.
pushNamed<T>(String routeName, {Object? arguments}) Future<T?>
Pushes a named route onto the navigation stack.
pushReplacement<T, TO>(Route<T> route, {TO? result}) Future<T?>
Pushes a route and removes the current top route.
pushReplacementNamed<T, TO>(String routeName, {Object? arguments, TO? result}) Future<T?>
Pushes a named route and removes the current top route.
pushWidget<T>(Widget child, {String? name}) Future<T?>
Pushes a widget directly as a PageRoute.
setState(void fn()) → void
Notifies the framework that this state's internal data has changed.
inherited
showDialog<T>({required RouteWidgetBuilder builder, bool barrierDismissible = true, Color? barrierColor, bool animateBarrier = true, Duration barrierAnimationDuration = const Duration(milliseconds: 200), Alignment alignment = Alignment.center, num? width, num? height, String? name}) Future<T?>
Shows a modal dialog by pushing a ModalRoute.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited