-
Notifications
You must be signed in to change notification settings - Fork 29.7k
migrate localization to null safety #84064
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
migrate localization to null safety #84064
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. 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. |
darrenaustin
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.
@Abhishek01039 thanks so much for the contribution. I have a few comments that need to be addressed before we can land this.
|
|
||
| final Set<String> keys = Set<String>.from( | ||
| resources.keys.where((String key) => !isPluralVariation(key)) | ||
| resources!.keys.where((String key) => !isPluralVariation(key)) |
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 think what @goderbauer was getting at is that here (line 125) we are assuming that resources is not null. If that is always the case then we should make resources non-nullable. If it can be null then the initialization for keys here needs to take that into account. Given that the existing code works with keys being initialized as they are I think we can assume it is not null.
| final List<String> missingKeys = <String>[]; | ||
| for (final String missingKey in canonicalKeys.difference(keys)) { | ||
| final dynamic attribute = attributes[missingKey]; | ||
| for (final String? missingKey in canonicalKeys.difference(keys)) { |
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.
If canonicalKeys is defined as Set<String> as mentioned above, then neither missingKeys or missingKey here would need to use nullable strings here.
darrenaustin
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.
Thanks for the update, but it looks like you missed the resources being non-null in localizations_validator.dart. Please update that and I think we will be good to go. Thx.
darrenaustin
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. Thanks!
|
Thanks @darrenaustin |
part of #84014