NavigationController class interface

A controller for managing the navigation stack.

When analyticsSink is provided, the controller emits screen-enter and screen-exit events to it as navigation happens. When omitted (or the const no-op sink is used), the controller runs without analytics — the "no analytics" build.

Inheritance

Constructors

Constructs a tabbed controller with independent per-branch stacks.
factory

Properties

activeBranchId NavigationBranchId
The active branch identifier.
no setter
activeBranchScreenName String?
The screen name used to serialize the active branch in the web URL.
no setter
branchIds List<NavigationBranchId>
All configured branch ids, in registration order.
no setter
no setter
currentNavigationStack List<ViewNavigationType>
Returns the current navigation stack
no setter
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isTabbed bool
Whether the controller was configured with multiple branches.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
Consumes the pending deep-link URI, if any.
dispose() Future<void>
Discards any resources used by the object.
override
flushAnalytics() Future<void>
Flushes pending analytics events. Only for testing.
Pushes a deep-link URI so that it is resolved by the route information parser and respects requiredPriorNavigation.
Navigates using the given action.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
present<T>(Present action) Future<T?>
Presents a screen and awaits the result it returns via Navigator.pop(context, result).
registerDismissCallback(ValueKey<String> pageKey, bool callback()) → void
Registers a dismiss callback for a specific page.
registerNavigationCallback(ValueKey<String> pageKey, bool callback(NavigationType action)) → void
Registers a navigation callback for a specific page.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removePoppedPageIfNotUserInitiated(String? removedPageName) bool
Removes the popped page if the navigation was not user initiated and there is a page to be removed.
stackForBranch(NavigationBranchId id) List<ViewNavigationType>
Returns the stack for id, or an empty list when unregistered.
toString() String
A string representation of this object.
inherited
unregisterDismissCallback(ValueKey<String> pageKey) → void
Unregisters a dismiss callback for a specific page.
unregisterNavigationCallback(ValueKey<String> pageKey) → void
Unregisters a navigation callback for a specific page.
wantsKeepAlive(NavigationBranchId id) bool
The keep-alive preference for id. Defaults to true for the anonymous default branch and unknown ids.

Operators

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