MomentumRouter class
A built-in momentum service for persistent navigation system.
- Inheritance
-
- Object
- MomentumService
- MomentumRouter
Constructors
-
MomentumRouter(List<
Widget> pages, {bool? enablePersistence}) - Create an instance of MomentumRouter that can be injected to momentum as a service. Takes a list of widgets as routes.
Properties
- exited → bool
-
Returns
true
if the.pop()
method is called while the router history is empty.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- isRoutesEmpty → bool
-
Indicates whether there are no more pages in the
navigation history.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearHistory(
) → Future< void> - Clear navigation history.
-
getActive(
) → Widget - Get the active widget from the router. You may want this to be your initial widget when your app starts.
-
getCurrentParam<
T extends RouterParam?> () → T? - Get the current route param without using context.
-
getService<
T extends MomentumService> ({bool runtimeType = true, dynamic alias}) → T -
A method for getting a service marked with
MomentumService that are injected into
Momentum root widget.
inherited
-
init(
) → Future< void> - You don't have to call this method. This is automatically called by the library.
-
mockParam(
RouterParam param) → void - For testing only.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset<
T extends Widget> () → Future< void> - Clear navigation history and set an initial page.
-
service<
T extends MomentumService> ({dynamic alias}) → T -
A method for getting a service marked with
MomentumService that are injected into
Momentum root widget.
inherited
-
setFunctions(
BuildContext context, PersistSaver? persistSaver, PersistGet? persistGet, MomentumEvent? momentumEvent) → void - You don't have to call this method. This is automatically called by the library.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
clearHistoryWithContext(
BuildContext context) → Future< void> - Clear navigation history using context.
-
getActivePage(
BuildContext context) → Widget - Get the active widget from the router. You may want this to be your initial widget when your app starts.
-
getParam<
T extends RouterParam> (BuildContext context) → T? -
Get the current route parameters specified using
the
params
parameter inMomentumRouter.goto(...)
method. -
goto(
BuildContext context, Type? route, {Route transition(BuildContext, Widget)?, RouterParam? params}) → void - The function to navigate to a specific route. You specify the route using a type NOT a string route name or a MaterialPageRoute.
-
pop(
BuildContext context, {Route transition(BuildContext, Widget)?, RouterParam? result}) → void -
Works like
Navigation.pop
. -
resetWithContext<
T extends Widget> (BuildContext context) → Future< void> - Clear navigation history using context and set an initial page.