[google_sign_in] Simply Kotlin/Java interop utils#11011
[google_sign_in] Simply Kotlin/Java interop utils#11011stuartmorgan-g wants to merge 1 commit intoflutter:mainfrom
Conversation
Replaces one-off wrappers with a templated version. While this isn't important in isolation, it sets a better precedent for us to follow for future plugins, and likely for Pigeon generation of helper utils.
|
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. |
There was a problem hiding this comment.
Code Review
This pull request introduces a good simplification to the Kotlin/Java interoperability helpers. It replaces four specific callback completion functions with a single, more flexible generic function completeWithValue. This change reduces code duplication in ResultUtils.kt and simplifies the native Android implementation. The call sites in GoogleSignInPlugin.java are updated accordingly. The CHANGELOG.md and pubspec.yaml are also updated to reflect this internal improvement.
|
test-exempt: code refactor with no semantic change |
Replaces one-off wrappers with a templated version. While this isn't important in isolation, it sets a better precedent for us to follow for future plugins, and likely for Pigeon generation of helper utils.
The "Unit" forms of the wrappers are still necessary because there's no way (AFAICT) to cause Java to infer the Unit type, since it's not a thing in Java.
I've validated that the type inference on the generic is still enforcing type safety based on the inferred type. I.e., if I try to pass the wrong value type, it won't compile.
Related to flutter/flutter#158287
Pre-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.///).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