RouterDelegate<T> class

A delegate that is used by the Router widget to build and configure a navigating widget.

This delegate is the core piece of the Router widget. It responds to push route and pop route intent from the engine and notifies the Router to rebuild. It also act as a builder for the Router widget and builds a navigating widget, typically a Navigator, when the Router widget builds.

When engine pushes a new route, the route information is parsed by the RouteInformationParser to produce a configuration of type T. The router delegate receives the configuration through setInitialRoutePath or setNewRoutePath to configure itself and builds the latest navigating widget upon asked.

When implementing subclass, consider defining a listenable app state to be used for building the navigating widget. The router delegate should update the app state accordingly and notify the listener know the app state has changed when it receive route related engine intents (e.g. setNewRoutePath, setInitialRoutePath, or popRoute).

All subclass must implement setNewRoutePath, popRoute, and build.

See also:

  • RouteInformationParser, which is responsible for parsing the route information to a configuration before passing in to router delegate.
  • Router, which is the widget that wires all the delegates together to provide a fully functional routing solution.
Inheritance

Constructors

RouterDelegate()

Properties

currentConfiguration → T
Called by the Router when it detects a route information may have changed as a result of rebuild. [...]
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

addListener(void listener()) → void
Register a closure to be called when the object notifies its listeners.
inherited
build(BuildContext context) Widget
Called by the Router to obtain the widget tree that represents the current state. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
popRoute() Future<bool>
Called by the Router when the Router.backButtonDispatcher reports that the operating system is requesting that the current route be popped. [...]
removeListener(void listener()) → void
Remove a previously registered closure from the list of closures that the object notifies.
inherited
setInitialRoutePath(T configuration) Future<void>
Called by the Router at startup with the structure that the RouteInformationParser obtained from parsing the initial route. [...]
setNewRoutePath(T 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. [...]
toString() String
Returns a string representation of this object.
inherited

Operators

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