-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[go_router_builder] Add support for relative routes #8476
base: main
Are you sure you want to change the base?
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.
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)
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.