[go_router_builder] Allow users to specify onExit as optional#11151
[go_router_builder] Allow users to specify onExit as optional#11151hantrungkien wants to merge 2 commits intoflutter:mainfrom
Conversation
…pedRelativeGoRoute` annotations.
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request adds an overrideOnExit parameter to TypedGoRoute and TypedRelativeGoRoute annotations. The builder is updated to read this parameter and add overrideOnExit: true to the generated GoRoute constructor when the parameter is set. This enables custom onExit callback implementations for typed routes. The changes also include updates to an example and the changelog. My feedback includes a suggestion to make the changelog entry more concise.
| - Adds support for `overrideOnExit` parameter in `TypedGoRoute` and `TypedRelativeGoRoute` annotations. | ||
| When set to `true`, the generated route will include `overrideOnExit: true` in the GoRoute constructor, enabling custom `onExit` callback implementation for the route. Defaults to `false`. |
There was a problem hiding this comment.
This changelog entry is a bit verbose. For better readability, it's good practice for changelog entries to be concise. Consider removing implementation details like what happens when the flag is true and its default value.
| - Adds support for `overrideOnExit` parameter in `TypedGoRoute` and `TypedRelativeGoRoute` annotations. | |
| When set to `true`, the generated route will include `overrideOnExit: true` in the GoRoute constructor, enabling custom `onExit` callback implementation for the route. Defaults to `false`. | |
| - Adds `overrideOnExit` parameter to `TypedGoRoute` and `TypedRelativeGoRoute` annotations to support custom `onExit` callbacks. |
|
Thanks for the contribution! You’ve checked boxes in the PR checklist above that are not reflected in this PR, so I’m assuming this is a work in progress and am marking it as a Draft. Please review the checklist, updating the PR as appropriate, and when the state of the PR as posted reflects the checklist please feel free to mark it as ready for review.
|
|
@stuartmorgan-g Thank you for your quick response. I’ve added the missing items. Please take a look and review them for me! Just a reminder that #11150 needs to be merged first. |
There was a problem hiding this comment.
Code Review
This pull request introduces an overrideOnExit parameter to TypedGoRoute and TypedRelativeGoRoute annotations, enabling developers to use the onExit callback on generated routes. No specific security issues were found in the provided code changes. I have one minor suggestion to improve the conciseness of the changelog entry.
| - Adds support for `overrideOnExit` parameter in `TypedGoRoute` and `TypedRelativeGoRoute` annotations. | ||
| When set to `true`, the generated route will include `overrideOnExit: true` in the GoRoute constructor, enabling custom `onExit` callback implementation for the route. Defaults to `false`. |
There was a problem hiding this comment.
This changelog entry is a bit verbose. For better conciseness, which is encouraged by the repository style guide, you could shorten it to be more in line with other entries in this file.
| - Adds support for `overrideOnExit` parameter in `TypedGoRoute` and `TypedRelativeGoRoute` annotations. | |
| When set to `true`, the generated route will include `overrideOnExit: true` in the GoRoute constructor, enabling custom `onExit` callback implementation for the route. Defaults to `false`. | |
| - Adds an `overrideOnExit` parameter to `TypedGoRoute` and `TypedRelativeGoRoute` annotations to allow custom `onExit` callback implementations. |
References
- The repository style guide, in the 'Review Agent Guidelines' section, states a preference for conciseness. While aimed at review summaries, this principle is valuable for changelogs to ensure they are easy to scan and understand. The suggested change makes the entry more direct. (link)
Related to flutter/flutter#183099
Allow users to specify onExit as optional
Needs #11150 to get merged first
Pre-Review Checklist
[shared_preferences]///).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