Repository navigation
Description
Use case
I'm developing an application that has a page that can be accessed via multiple locations:
The page is DetailsPage and is accessible from HomePage and ListPage
For now to access it I need to define two routes: /home/details and /list/details
Which gives the following code
GoRoute(
path: '/',
// ...
routes: [
GoRoute(
path: 'home',
routes: [
GoRoute(path:'details'),
]
),
GoRoute(
path: 'list',
routes: [
GoRoute(path:'details'),
]
),
]
)It duplicates the route declaration and is not ideal at all. (It is ok when the route has only two access points but what if it has 10 or not event a pre determined number?)
Proposal
A solution to that would be to be able to declare some GoRoutes as accessible from multiple points.
Either allowing for something like
// Re usable subroute route
GoSubRoute(
path: 'details',
accessibleFrom: ['/home', '/list'],
)Or even using wildcard or regexp
GoRoute(
path: '*/details',
)That last solution has the advantage of allowing the opening of any stack of pages from a deeplink (for example /home/list/details) without having to define all the possible routes as it is required today.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
kwado-tech commentedon Aug 14, 2023
@chunhtai, please, any updates on this as this elaborates a very practical usecase.
chunhtai commentedon Aug 14, 2023
you can already do this with
kwado-tech commentedon Aug 15, 2023
@chunhtai Thanks. Can you point me to some expressive documentation/resource on this to grasp a proper usecase.
chunhtai commentedon Aug 15, 2023
https://pub.dev/documentation/go_router/latest/topics/Configuration-topic.html
Parameters section
Example:
https://github.com/flutter/packages/blob/main/packages/go_router/example/lib/path_and_query_parameters.dart
you can also use regex with path parameter
chunhtai commentedon Aug 15, 2023
Closing this bug
ASISBusiness commentedon Aug 15, 2023
github-actions commentedon Aug 29, 2023
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.