-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[go_router_builder] Add support for relative routes #8476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Adds `TypedRelativeGoRoute`
…for `concatenateUris`
…ly use dependency_overrides to take local go_router
…Route's extension
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is different between using this vs a regular TypedGoRoute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example I gave isn't clearly explaining the purpose. Let me update this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this makes sense. I will take another look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just updated the example
final GoRouter _router = GoRouter( | ||
routes: $appRoutes, | ||
); | ||
const TypedRelativeGoRoute<DetailsRoute> detailRoute = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment #8476 (comment)
Hi there @ThangVuNguyenViet, thanks much for contributing! Are you still able to work on this to complete the few things mentioned? |
hey @mit-mit I don't think what she mentioned was relevant |
Hey @ThangVuNguyenViet I'd love to help you get this in. Currently there are several failing tests, can you take a look? |
@Piinks there seems to be a new convention for go_router_builder, which requires |
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
btw I am unable to run the |
…s much as possible. Add case sensitive support. Fix failing tests
@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 |
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. |
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. |
@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 resolve flutter/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.
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 resolves flutter/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.
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 resolve flutter/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 resolves flutter/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 resolves flutter/flutter#108177, which allow users to use
TypedRelativeGoRoute
to 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
TypedGoRoute
it will declare multiple extensions of a same thing and produce build time errorPre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to 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.