UiNavigatorHistoryObserver class

Tracks the full stack of top-level PageRoutes pushed through whichever Navigator this observer is attached to, plus a title registered by each page's own chrome — so UiSliverNavigationBar's long-press-back history menu can show the entire stack for apps using a plain Flutter Navigator (Navigator.push/pushNamed), the same way UiNavigationControllerScope already does for apps built on UiNavigationController.

UiApp installs and shares one of these automatically — most apps never construct this directly. UiSliverNavigationBar registers its own UiNavigationSpec.title against the current route on every build, so history titles stay accurate without any additional app-side wiring.

Only PageRoutes are tracked, so a transient dialog or bottom sheet pushed via showDialog/showModalBottomSheet never appears in — or skews the pop-count arithmetic of — the history menu.

Inheritance
Mixed-in types

Properties

hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
The navigator that the observer is observing, if any.
no setterinherited
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
didChangeTop(Route topRoute, Route? previousTopRoute) → void
The top most route has changed.
inherited
didPop(Route route, Route? previousRoute) → void
The Navigator popped route.
override
didPush(Route route, Route? previousRoute) → void
The Navigator pushed route.
override
didRemove(Route route, Route? previousRoute) → void
The Navigator removed route.
override
didReplace({Route? newRoute, Route? oldRoute}) → void
The Navigator replaced oldRoute with newRoute.
override
didStartUserGesture(Route route, Route? previousRoute) → void
The Navigator's routes are being moved by a user gesture.
inherited
didStopUserGesture() → void
User gesture is no longer controlling the Navigator.
inherited
dispose() → void
Discards any resources used by the object.
inherited
historyItems() List<UiNavigationBackHistoryItem>
Entries behind the current top, newest first — the shape a long-press-back history menu wants. A route with no registered title and no RouteSettings.name is omitted from the menu but still counted toward the UiNavigationBackPopTarget.count of entries behind it, so selecting one of those still pops the correct number of times.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
registerTitle(Route route, String title) → void
Associates title with route so it can be shown in the history menu once route is behind the current top of stack. Safe to call on every build — a no-op when the title hasn't changed, and deliberately does not call notifyListeners: this is meant to be called from UiSliverNavigationBar's own build, and notifying synchronously from inside another widget's build (which InheritedNotifier would turn into a synchronous rebuild request) is invalid. The title is still current by the time anything else reads historyItems.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
toString() String
A string representation of this object.
inherited

Operators

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