NavigationController class
A NavigationController manages the navigation state.
Using the given destinations list, it maintains the navigation stack.
The navigation stack is updated when a user navigates to specified destination by calling goTo method, or returns back with goBack method.
The navigation controller (navigator) provides an access to a currentDestination, which is one on the top of the stack.
Initially, the navigation stack contains a destination at initialDestinationIndex in the provided list of destinations.
NavigationController implements ChangeNotifier and notifies its listener when the currentDestination/stack is changed, or some error was happened.
See also:
- Mixed in types
Constructors
- Creates navigation controller instance.
Properties
-
backFrom
→ Destination<
DestinationParameters> ? -
The destination from goBack action is performed.
no setter
- builder → NavigatorBuilder
-
An implementation of NavigatorBuilder which creates a navigation UI.
final
-
currentDestination
→ Destination<
DestinationParameters> -
The current destination of the navigator.
no setter
-
destinations
→ List<
Destination< DestinationParameters> > -
List of destinations, which this navigator operate of.
final
- error → NavigationControllerError?
-
Error details
no setter
- hasError → bool
-
Whether an error was happened on last goTo or goBack action.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- initialDestinationIndex → int
-
Index of the initial destination.
final
- keepStateInParameters → bool
-
Indicates if persisting of navigation state in destination parameters is needed.
no setter
- notifyOnError → bool
-
Whether to notify listeners on errors in navigation actions.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shouldClose → bool
-
Whether the navigator should close.
no setter
-
stack
→ List<
Destination< DestinationParameters> > -
The navigation stack.
no setter
- tag → String?
-
An identifier of this navigator.
final
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
build(
BuildContext context) → Widget - Builds a widget that wraps destinations of the navigator.
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
goBack(
) → void - Closes the current destination.
-
goTo(
Destination< DestinationParameters> destination) → Future<void> - Opens specified destination.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
resetStack(
List< Destination< destinations) → voidDestinationParameters> > - Explicitly set the navigation stack.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited