Navigator class
A widget that manages a stack of routes, analogous to Flutter's Navigator.
- Inheritance
-
- Object
- Widget
- StatefulWidget
- Navigator
Constructors
-
Creates a Navigator.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- home → Widget?
-
The widget displayed when the route history is empty.
final
- initialRoute → String?
-
The name of the initial route to display.
final
- key → Key?
-
Controls how one widget replaces another in the tree.
finalinherited
-
observers
→ List<
NavigatorObserver> ? -
Observers notified of route transitions.
final
-
routes
→ Map<
String, RouteBuilder> ? -
A map of route names to builder functions.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates the Element for this widget.
inherited
-
createState(
) → NavigatorState -
Creates the mutable state for this widget.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- focusManager → FocusManager
-
Returns the singleton FocusManager instance.
no setter
Static Methods
-
of(
BuildContext context) → NavigatorState - Returns the NavigatorState of the nearest Navigator ancestor.
-
pop(
BuildContext context, [Object? result]) → bool -
Pops the top route off the navigator nearest to
context. -
popUntil(
BuildContext context, RoutePredicate predicate, [Object? result]) → void -
Calls pop repeatedly on the navigator nearest to
contextuntilpredicatereturns true. -
push<
T> (BuildContext context, Route route) → Future< T?> -
Pushes the given
routeonto the navigator nearest tocontext. -
pushNamed<
T> (BuildContext context, String routeName, {Object? arguments}) → Future< T?> -
Pushes a named route onto the navigator nearest to
context. -
pushReplacement<
T> (BuildContext context, Route route, [Object? result]) → Future< T?> -
Replaces the current route on the navigator nearest to
context. -
pushReplacementNamed<
T> (BuildContext context, String routeName, {Object? arguments, Object? result}) → Future< T?> -
Replaces the current route with a named route on the navigator nearest to
context.