'How to handle the navigation address parameters for flutter web
I would like the handle the navigation of flutter web like a normal website => "...com/en-gb/clothing?page=2&perpage=45". How to use the navigation with several parameters like page or perpage. I use auto_route and algolia. I can go to a specific product like in the example of auto_route or change the page or perpage etc... But now it's just a state(Riverpod). I use @PathParam('') to get the argument. How to change the navigation with all that parameters? If someone know the answer I could share the whole project.
const ItemsView(
{@PathParam('query') this.query,
@PathParam('setHitsPerPage') this.setHitsPerPage,
@PathParam('setPage') this.setPage,
@PathParam('facetFilter') this.facetFilter,
this.algoliaSortFacetValuesBy = AlgoliaSortFacetValuesBy.count,
Key? key})
: super(key: key);
@MaterialAutoRouter(
routes: <AutoRoute>[
AutoRoute(page: Home, path: "/items", initial: true, children: [
AutoRoute(
path:
"page:setPage/perpage:setHitsPerPage/query:query/tag:facetFilter",
page: ItemsView,
initial: true),
AutoRoute(path: ":id", page: ItemDetails),
RedirectRoute(
path: '',
redirectTo:
'page:setPage/perpage:setHitsPerPage/query:query/tag:facetFilter')
]),
RedirectRoute(path: '', redirectTo: '/items')
],
)
class $AppRouter {}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
