-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[go_router] Add TypedQueryParameter annotation
#10792
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] Add TypedQueryParameter annotation
#10792
Conversation
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.
Code Review
This pull request introduces the TypedGoRouteParameter annotation, which allows developers to customize URI parameter names in type-safe routes. The changes include the new annotation class, updates to the pubspec.yaml and CHANGELOG.md, and a unit test for the new class. My feedback focuses on ensuring the documentation for this new feature is clear and consistent with existing conventions.
|
go_router_builder PR: #10793 |
c704608 to
ab858c7
Compare
TypedGoRouteParameter annotationTypedQueryParameter annotation
ab858c7 to
acfcffe
Compare
acfcffe to
da43e69
Compare
da43e69 to
6117e04
Compare
| /// This will result in a route that matches | ||
| /// `/my-route?custom_name=some_value` instead of the default | ||
| /// `/my-route?my-parameter=some_value`. | ||
| final String? name; |
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.
as we discussed, can you add some documentation around escaped character
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.
Sure, I added a sentence in fix changelog and add more doc. Is that okay for you?
packages/go_router/CHANGELOG.md
Outdated
| @@ -1,3 +1,7 @@ | |||
| # 17.1.0 | |||
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.
| # 17.1.0 | |
| ## 17.1.0 |
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.
Fixed in fix changelog and add more doc
6117e04 to
e53ebe5
Compare
chunhtai
left a comment
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.
LGTM
hannah-hyj
left a comment
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.
LGTM
flutter/packages@837dbbd...5b1bea8 2026-02-03 [email protected] [camera_avfoundation] handle interruptions and use single offset (flutter/packages#8982) 2026-02-03 [email protected] [go_router] Add `TypedQueryParameter` annotation (flutter/packages#10792) 2026-02-02 [email protected] [local_auth_darwin][UIScene] Add UIScene lifecycle support (flutter/packages#10836) 2026-02-02 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump camerax_version from 1.5.2 to 1.5.3 in /packages/camera/camera_android_camerax/android (flutter/packages#10946) 2026-02-02 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump gradle-wrapper from 8.13 to 9.3.1 in /packages/video_player/video_player/example/android/app (flutter/packages#10945) 2026-02-02 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump gradle-wrapper from 8.13 to 9.3.1 in /packages/local_auth/local_auth_android/example/android/app (flutter/packages#10941) 2026-02-02 [email protected] Roll Flutter from 9eafba4 to c305f1f (12 revisions) (flutter/packages#10956) 2026-02-02 [email protected] Roll Flutter from 1d9d6a9 to 9eafba4 (27 revisions) (flutter/packages#10938) 2026-02-02 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump org.json:json from 20250517 to 20251224 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#10949) 2026-02-02 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump the test-dependencies group across 2 directories with 1 update (flutter/packages#10944) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…mize parameter names (#10793) Relates to flutter/flutter#112152 Add support for `@TypedGoRouteParameter` to customize parameter names Needs #10792 to get merged first ## 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.
…er#181857) flutter/packages@837dbbd...5b1bea8 2026-02-03 [email protected] [camera_avfoundation] handle interruptions and use single offset (flutter/packages#8982) 2026-02-03 [email protected] [go_router] Add `TypedQueryParameter` annotation (flutter/packages#10792) 2026-02-02 [email protected] [local_auth_darwin][UIScene] Add UIScene lifecycle support (flutter/packages#10836) 2026-02-02 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump camerax_version from 1.5.2 to 1.5.3 in /packages/camera/camera_android_camerax/android (flutter/packages#10946) 2026-02-02 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump gradle-wrapper from 8.13 to 9.3.1 in /packages/video_player/video_player/example/android/app (flutter/packages#10945) 2026-02-02 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump gradle-wrapper from 8.13 to 9.3.1 in /packages/local_auth/local_auth_android/example/android/app (flutter/packages#10941) 2026-02-02 [email protected] Roll Flutter from 9eafba4 to c305f1f (12 revisions) (flutter/packages#10956) 2026-02-02 [email protected] Roll Flutter from 1d9d6a9 to 9eafba4 (27 revisions) (flutter/packages#10938) 2026-02-02 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump org.json:json from 20250517 to 20251224 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#10949) 2026-02-02 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump the test-dependencies group across 2 directories with 1 update (flutter/packages#10944) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…er#181857) flutter/packages@837dbbd...5b1bea8 2026-02-03 [email protected] [camera_avfoundation] handle interruptions and use single offset (flutter/packages#8982) 2026-02-03 [email protected] [go_router] Add `TypedQueryParameter` annotation (flutter/packages#10792) 2026-02-02 [email protected] [local_auth_darwin][UIScene] Add UIScene lifecycle support (flutter/packages#10836) 2026-02-02 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump camerax_version from 1.5.2 to 1.5.3 in /packages/camera/camera_android_camerax/android (flutter/packages#10946) 2026-02-02 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump gradle-wrapper from 8.13 to 9.3.1 in /packages/video_player/video_player/example/android/app (flutter/packages#10945) 2026-02-02 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump gradle-wrapper from 8.13 to 9.3.1 in /packages/local_auth/local_auth_android/example/android/app (flutter/packages#10941) 2026-02-02 [email protected] Roll Flutter from 9eafba4 to c305f1f (12 revisions) (flutter/packages#10956) 2026-02-02 [email protected] Roll Flutter from 1d9d6a9 to 9eafba4 (27 revisions) (flutter/packages#10938) 2026-02-02 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump org.json:json from 20250517 to 20251224 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#10949) 2026-02-02 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump the test-dependencies group across 2 directories with 1 update (flutter/packages#10944) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Relates to flutter/flutter#112152
Adds
TypedGoRouteParameterannotationPre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot 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.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3