AppRouterDelegate class

Router that supports navigation via AppRoute. The current configuration of the router is represented by an AppRouteState.

App routes are very simple data classes containing information about the target route. An app route state represents the complete state of the current route as well as several additional routes for each item in the main app screen.

Requests for routing to an app route are handled by creating a copy of the current app route state with the given route as the current route. This new route state is used as the current configuration and the navigator is built accordingly.

This router also automatically shows the OnboardingScreen if there is no user currently logged in. It then redirects to the main app automatically if a user logs in.

Inheritance
Implemented types
Mixed-in types

Constructors

AppRouterDelegate({List<NavigatorObserver> navigatorObservers = const []})

Properties

currentConfiguration AppRouteState
Called by the Router when it detects a route information may have changed as a result of rebuild.
getter/setter pairoverride-getter
currentRoute AppRoute
Returns the closest representation of the top-most current route being viewed by the user.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
final
final
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
addNavigateInterceptor(NavigateInterceptor interceptor) → void
Add an interceptor which can veto attempts to navigate to a different app route.
override
build(BuildContext context) Widget
Called by the Router to obtain the widget tree that represents the current state.
override
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
Navigate to the given app route.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
onDidPopAppRoute(AppRoute route) → void
Notify the router that the given app route was popped.
override
popAppRoute() bool
Pop the current top-most app route.
override
popRoute() Future<bool>
Called by the Router when the Router.backButtonDispatcher reports that the operating system is requesting that the current route be popped.
override
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removeNavigateInterceptor(NavigateInterceptor interceptor) → void
Remove one of the interceptor callbacks added via addNavigateInterceptor
override
setInitialRoutePath(AppRouteState configuration) Future<void>
Called by the Router at startup with the structure that the RouteInformationParser obtained from parsing the initial route.
inherited
setNewRoutePath(AppRouteState configuration) Future<void>
Called by the Router when the Router.routeInformationProvider reports that a new route has been pushed to the application by the operating system.
override
setRestoredRoutePath(AppRouteState configuration) Future<void>
Called by the Router during state restoration.
inherited
toString() String
A string representation of this object.
inherited

Operators

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