QMiddleware class
QMiddleware is a class that can be used to add middleware to a route you can use it to to run code on different route events like onEnter, onExit, onMatch
- Implementers
Constructors
- QMiddleware({int priority = 500})
-
QMiddleware constructor
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- priority → int
-
The priority of the middleware, the lower the number the higher the priority
Middleware with the same priority will be executed in the order they were added
Middleware with higher priority will be executed first
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
canPop(
) → Future< bool> - can this route pop, called when trying to remove the page. if this function returns false the page will not be removed and the navigation will not continue this is useful for example if you want to show a dialog to the user to confirm that he wants to leave the page and if he doesn't want to leave the page you can return false and the page will not be removed
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onEnter(
) → Future - This function will be called before onEnter and after onMatch if the result from this page is null the page will be created or the result should be the path to redirect to.
-
onExit(
) → Future - This method will be called before removing the page from the stack and before the page is disposed this is useful for saving data before the page is removed
-
onExited(
) → void - This method will be called after one frame after removing the page from the stack this is useful for cleaning up resources that are not needed anymore like closing a stream or a controller or for example if you want to show a snackbar after the page was removed you can use this method to show the snackbar
-
onMatch(
) → Future - This method will be called every time a path match it.
-
redirectGuard(
String path) → Future< String?> - This function will be called before onEnter and after onMatch if the result from this page is null the page will be created or the result should be the path to redirect to.
-
redirectGuardToName(
String path) → Future< QNameRedirect?> - This function will be called before onEnter and after onMatch if the result from this page is null the page will be created or the result should be the name of the page to redirect to. but here you can redirect to name with params instead of path.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited