Uh oh!
There was an error while loading. Please reload this page.
[go_router_builder] Add support for relative routes - #8476
[go_router_builder] Add support for relative routes#8476ThangVuNguyenViet wants to merge 32 commits into
Conversation
- Adds `TypedRelativeGoRoute`
…for `concatenateUris`
…ly use dependency_overrides to take local go_router
ThangVuNguyenViet
commented
Jan 22, 2025
@chunhtai same issue I asked in the old PR. The test will fail without the temp dependency_overrides. Should I make a PR that contains only the |
| final GoRouter _router = GoRouter( | ||
| routes: $appRoutes, | ||
| ); | ||
| const TypedRelativeGoRoute<DetailsRoute> detailRoute = |
There was a problem hiding this comment.
What is different between using this vs a regular TypedGoRoute?
There was a problem hiding this comment.
The example I gave isn't clearly explaining the purpose. Let me update this
There was a problem hiding this comment.
I still can't see the difference. Is this a way to reuse the typedGoRoute in multiple places in the routing tree?
There was a problem hiding this comment.
Yes. Without this you'd have to define routes like
SettingsFromHomeRoute
SettingsFromDashboardRoute
And those routes all build (or build page) the same screen
There was a problem hiding this comment.
yeah this makes sense. I will take another look
ThangVuNguyenViet
left a comment
There was a problem hiding this comment.
just updated the example
| final GoRouter _router = GoRouter( | ||
| routes: $appRoutes, | ||
| ); | ||
| const TypedRelativeGoRoute<DetailsRoute> detailRoute = |
chunhtai
left a comment
There was a problem hiding this comment.
See my comment #8476 (comment)
Piinks
commented
Jul 8, 2025
Hey @ThangVuNguyenViet I'd love to help you get this in. Currently there are several failing tests, can you take a look? |
ThangVuNguyenViet
commented
Jul 9, 2025
@Piinks there seems to be a new convention for go_router_builder, which requires |
ThangVuNguyenViet
commented
Jul 9, 2025
There are lots of breaking changes in #9277 that results in this test run failure. Specifically it throws After carefully inspected the changes, I've removed 1 breaking change that that PR made, which is the adding of
I'm removing that set of routing methods in the upcoming commits, and adapting the generation of |
…ator to use mixin instead of extension. Update tests to use appropriate mixins
ThangVuNguyenViet
commented
Jul 9, 2025
btw I am unable to run the |
…s much as possible. Add case sensitive support. Fix failing tests
ThangVuNguyenViet
commented
Jul 9, 2025
@Piinks please assist me on the breaking change. I think removing that part was right, but if you tell me that wasn't the right direction, I'm happy to bring it back and make changes as needed |
Piinks
commented
Jul 9, 2025
I don't think undoing the other change as part of this one is the right course of action. That change has already been published, and undoing it would be another breaking change. |
Uh oh!
There was an error while loading. Please reload this page.
ThangVuNguyenViet
commented
Jul 10, 2025
justinmc
commented
Jul 21, 2025
There's a failure here that can probably be fixed with a merge/rebase. |
Thank you for all the work you've put into this PR. To help this feature move forward, I have opened two new PRs (#9732, #9749). Please let me know if you have any feedback or see any issues with this approach. |
Is it this fork? I want to use it until this PR has been merged. |
thangmoxielabs
commented
Aug 6, 2025
@abdullahalamodi you should've used the |
) Adds `RelativeGoRouteData` and `TypedRelativeGoRoute` to support type-safe relative routes. Foundation for #9749 which adds relative route support in `go_router_builder`. Continuation of #8476 by @ThangVuNguyenViet Compared to #8476, the approach taken in this PR avoids breaking changes and creates a separate `RouteData` subclass instead of extending `GoRouteData`. The approach increases flexibility and avoids extending behavior that might not make sense for a relative route. Necessary to fully resolveflutter/flutter#108177. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
chunhtai
commented
Aug 18, 2025
closing this one since this is superseded by the new prs |
Adds support for TypedRelativeGoRoute. Builds on #9732 Continuation of #8476 by @ThangVuNguyenViet Compared to #8476, the approach taken in this PR avoids breaking changes and creates a separate RouteData subclass instead of extending GoRouteData. The approach increases flexibility and avoids extending behavior that might not make sense for a relative route. Fully resolvesflutter/flutter#108177. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
LukasMirbt
commented
Aug 19, 2025
Support for relative routes in |
…utter#9732) Adds `RelativeGoRouteData` and `TypedRelativeGoRoute` to support type-safe relative routes. Foundation for flutter#9749 which adds relative route support in `go_router_builder`. Continuation of flutter#8476 by @ThangVuNguyenViet Compared to flutter#8476, the approach taken in this PR avoids breaking changes and creates a separate `RouteData` subclass instead of extending `GoRouteData`. The approach increases flexibility and avoids extending behavior that might not make sense for a relative route. Necessary to fully resolveflutter/flutter#108177. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
Adds support for TypedRelativeGoRoute. Builds on flutter#9732 Continuation of flutter#8476 by @ThangVuNguyenViet Compared to flutter#8476, the approach taken in this PR avoids breaking changes and creates a separate RouteData subclass instead of extending GoRouteData. The approach increases flexibility and avoids extending behavior that might not make sense for a relative route. Fully resolvesflutter/flutter#108177. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
…utter#9732) Adds `RelativeGoRouteData` and `TypedRelativeGoRoute` to support type-safe relative routes. Foundation for flutter#9749 which adds relative route support in `go_router_builder`. Continuation of flutter#8476 by @ThangVuNguyenViet Compared to flutter#8476, the approach taken in this PR avoids breaking changes and creates a separate `RouteData` subclass instead of extending `GoRouteData`. The approach increases flexibility and avoids extending behavior that might not make sense for a relative route. Necessary to fully resolveflutter/flutter#108177. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
Adds support for TypedRelativeGoRoute. Builds on flutter#9732 Continuation of flutter#8476 by @ThangVuNguyenViet Compared to flutter#8476, the approach taken in this PR avoids breaking changes and creates a separate RouteData subclass instead of extending GoRouteData. The approach increases flexibility and avoids extending behavior that might not make sense for a relative route. Fully resolvesflutter/flutter#108177. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.



This PR is a 2nd part of #6825 to fully resolvesflutter/flutter#108177, which allow users to use
TypedRelativeGoRouteto construct the route relatively.This is a continuation of #7174
Example:
Basically the added TypedRelativeGoRoute allows us to construct the route tree above. If we replace it with the existing
TypedGoRouteit will declare multiple extensions of a same thing and produce build time errorPre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or this PR is exempt from CHANGELOG changes.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.