QMiddlewareBuilder class

QMiddlewareBuilder is a class that can be used to add middleware to a route it can be used for quick creation of middleware

Inheritance

Constructors

QMiddlewareBuilder({Future<String?> redirectGuardFunc(String)?, Future<QNameRedirect?> redirectGuardNameFunc(String)?, Future onMatchFunc()?, Future onEnterFunc()?, Future<bool> canPopFunc()?, Future onExitFunc()?, Function? onExitedFunc, int priority = 500})
QMiddlewareBuilder constructor

Properties

canPopFunc → (Future<bool> Function()?)
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
final
hashCode int
The hash code for this object.
no setterinherited
onEnterFunc → (Future Function()?)
final
onExitedFunc Function?
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
final
onExitFunc → (Future Function()?)
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
final
onMatchFunc → (Future Function()?)
This method will be called every time a path match it.
final
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
finalinherited
redirectGuardFunc → (Future<String?> Function(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.
final
redirectGuardNameFunc → (Future<QNameRedirect?> Function(String)?)
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
override
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.
override
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
override
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
override
onMatch() Future
This method will be called every time a path match it.
override
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.
override
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.
override
toString() String
A string representation of this object.
inherited

Operators

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