-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[go_router_builder] [in_app_purchase_storekit] Removes redundant arguments from annotations #9964
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
base: main
Are you sure you want to change the base?
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 focuses on code cleanup by removing redundant arguments in annotations, addressing a lint for avoid_redundant_argument_values
. The changes are applied to TypedShellRoute
annotations in test files for go_router_builder
and a JsonKey
annotation in in_app_purchase_storekit
. The changes are straightforward and improve code conciseness.
@@ -384,7 +384,7 @@ class SKProductDiscountWrapper { | |||
/// A string used to uniquely identify a discount offer for a product. | |||
/// | |||
/// You set up offers and their identifiers in App Store Connect. | |||
@JsonKey(defaultValue: null) | |||
@JsonKey() |
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.
Thanks for removing the redundant defaultValue: null
. However, it looks like the corresponding generated file, sk_product_wrapper.g.dart
, hasn't been updated. As noted in the file header, changes to @JsonSerializable
classes require running the build runner. Please run the generator and commit the updated .g.dart
file to ensure the generated code is in sync with this change.
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 for go_router part
@@ -121,6 +121,7 @@ class _SerializedEnums { | |||
late SKPaymentTransactionStateWrapper response; | |||
late SKSubscriptionPeriodUnit unit; | |||
late SKProductDiscountPaymentMode discountPaymentMode; | |||
late SKProductDiscountType discountType; |
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.
Hi @LouiseHsu this class doesn't seem to be read by anyone, and the code generator seems to be generating _$SKProductDiscountTypeEnumMap
just fine without it being added to _SerializedEnums
. Do you think this type can be removed?
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.
and the code generator seems to be generating _$SKProductDiscountTypeEnumMap just fine without it being added to _SerializedEnums.
I couldn't do without it.
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'm not familiar with json_serializable.dart, but the following code already exists in enum_converters.g.dart
today:
const _$SKProductDiscountTypeEnumMap = {
SKProductDiscountType.introductory: 0,
SKProductDiscountType.subscription: 1,
};
you mean if you rerun code gen the above map const is removed from the generated source code, without that new field in _SerializedEnums
?
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.
you mean if you rerun code gen the above map const is removed from the generated source code, without that new field
Exactly. See the second commit on this branch, I simply ran the build and pushed, expecting any diagnostics to be stale analysis that would get fixed once it was updated. Once I saw the bots failed, I actually looked at the output and diagnostics.
So I had to add that and remove the ?
from the map key for it to build. It was also warning on the terminal (while building) about the annotations version, so I upgraded it as well.
I'm not sure why this line was missing, if it was removed by mistake or something, but it would not generate this without it.
The CI is complaining about missing versionbump / changelog (see: https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#version-and-changelog-updates). The IAP change seems to involve a signature change, could you bump the version of that package? |
I'd asked about it at #9964 (comment). Will do. Thanks! |
@chunhtai do you think the go_router_builder change needs a version bump (I think that's blocking the CI)? If not I think we should put on the override tag. |
It was found, at the issue below, a false-negative for the
avoid_redundant_argument_values
lint where it wasn't triggered for annotations. This PR simply removes the redundant arguments.avoid_redundant_argument_values
and annotation coverage dart-lang/sdk#61456Pre-Review Checklist
[shared_preferences]
pubspec.yaml
with 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.md
to 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-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.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