Repository navigation
Open
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: go_routerThe go_router packageThe go_router packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem teamworkaround availableThere is a workaround available to overcome the issueThere is a workaround available to overcome the issue
Description
Use case
Navigate packages are made to make it easier to handle routing, and now GoRouter has completely ignored this principle by making it difficult and removing a variety of commonly used methods.
In the Velocity_x package, I have the possibility to insert the route as a RegExp, and now this is not possible in GoRouter, and only the
parameters are handled through the RegExp!
Expected RegExp path:
static const resetPasswordScreen = "\/(resetPasswordProfile|profile)(\/password)?";
The above RegExp should support the following four paths:
---> resetPasswordScreen = "/resetPasswordProfile"
---> resetPasswordScreen = "/resetPasswordProfile/password"
---> resetPasswordScreen = "/profile"
---> resetPasswordScreen = "/profile/password"
GoRoute(
name: 'resetPasswordScreen',
path: resetPasswordScreen,
parentNavigatorKey: rootNavigatorKey,
pageBuilder: (context, state) => _transitionPageBuilder(context, state, const ResetPasswordProfile()),
)
I want to know this feature exist or not, and if not, can you implement it?
Proposal
static const resetPasswordScreen = "\/(resetPasswordProfile|profile)(\/password)?";
GoRoute(
name: 'resetPasswordScreen',
path: resetPasswordScreen,
parentNavigatorKey: rootNavigatorKey,
pageBuilder: (context, state) => _transitionPageBuilder(context, state, const ResetPasswordProfile()),
)
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: go_routerThe go_router packageThe go_router packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem teamworkaround availableThere is a workaround available to overcome the issueThere is a workaround available to overcome the issue
Activity
darshankawar commentedon Feb 7, 2024
@jimpatrick
Can you take a look at this and see if it helps in your case or not ?
jimpatrick commentedon Feb 9, 2024
No, as I said, only parameters can be checked by RegExp in GoRouter, and this is different from my case.
Please check
pathin GoRouter package.Codes about RegExp in GoRouter package
darshankawar commentedon Feb 12, 2024
Thanks for the feedback.
chunhtai commentedon Apr 25, 2024
I think you can workaround this by define two goRoute
GoRoute(/:id(resetPasswordProfile|profile))GoRoute(/:id(resetPasswordProfile|profile)/password)jimpatrick commentedon Jul 31, 2024
Good idea but it's not perfect!
Pathparameter in GoRouter class should supportRegEx:)YukiAttano commentedon Oct 30, 2025
I guess this issue i already fixed?
I am able to use the regex feature to use subpaths too.
Example:
/home:param(.*)works in my project (GoRouter 16.2.4) and picks everything after /home and puts it into a String field of my route, even subroutes.
(This obviously disables the ability of GoRouter to detect manually defined subroutes for that route, as everything matches the regex)
EDIT: i just setup a minimal example project and it seems that this does only work with go_router_builder