NavStackController class Null safety

Mixed in types



args String
hashCode int
The hash code for this object.
hasListeners bool
Whether any listeners are currently registered.
history List<String>
read / write
initialPath String?
Determines what the initial path should be (if the OS has not provided one)
onRouteChanging → (void Function?(String value)?)
Called whenever the current path has changed
path String
read / write
runtimeType Type
A representation of the runtime type of the object.
stackBuilder PathStack Function(BuildContext context, NavStackController controller)
Must return a PathStack widget


addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
clearHistory() → void
Removes all history except the current
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).
goBack() bool
Steps back one level in the NavStack history
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
notifyListeners() → void
Call all the registered listeners.
popMatching(String value, {bool exactMatch = false}) → void
Go back in history and grab the first route that does not match the provided route. Used in this demo to close all of the details pages you might have in your history stack
popUntil(String value, {bool exactMatch = false}) → void
Pop all pages until we find a match
redirect(String path, {VoidCallback? onComplete}) → void
Meant to be used from with onBeforeUpdate inside of StackRouteBuilder, Changes path in the next frame to avoid errors when building mid-build.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
replacePath(String value) → void
Changes path without creating a new entry stack
toString() String
A string representation of this object.


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

Static Methods

of(BuildContext context) NavStackController