Skip to content

Conversation

@chunhtai
Copy link
Contributor

@chunhtai chunhtai commented Sep 12, 2022

fixes #90633

4th attempt after a year. Let us pray

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) a: text input Entering text in a text field or keyboard related problems c: contributor-productivity Team-specific productivity, code health, technical debt. labels Sep 12, 2022
@chunhtai chunhtai marked this pull request as ready for review September 12, 2022 21:27
@chunhtai chunhtai requested a review from goderbauer September 12, 2022 21:27
Copy link
Contributor

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

}

void _updateRadio(int newValue) {
void _updateRadio(int? newValue) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this should not be nullable, since is always asserted to be non-null. Either that, or below it shouldn't assert, but rather set to zero or something if the value is null.

Copy link
Contributor Author

@chunhtai chunhtai Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function signature is ValueChange(T?), It can be null if the radioButton is toggle-able. Since the radiobutton is built without toggle-able. I can be sure it won't be null.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't mean add an assert (I was calling the ! an assertion that it is non-null, which it is, but it's not an "assert", sorry for being confusing).

I'm just saying that if the argument is nullable, and you always force the value to be non-null, then perhaps either the argument should be also non-nullable (which I understand is different than the signature for Radio.onChanged), or the value shouldn't be always forced to non-nullable, and be something like _radio = newValue ?? 0 instead of _radio = newValue!.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be nullable for the different use cases of RadioButton, but It can't be null in the RadioButton use case in this file.

If it is null here, that means something is wrong in the code in this file. I think a force cast would be more preferable in this case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah,OK, I guess since it's a test it's probably fine.

@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 12, 2022
@auto-submit auto-submit bot merged commit 0df0e2e into flutter:master Sep 12, 2022
zanderso added a commit that referenced this pull request Sep 13, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 13, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Sep 13, 2022
chunhtai added a commit to chunhtai/flutter that referenced this pull request Sep 13, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) a: text input Entering text in a text field or keyboard related problems autosubmit Merge PR when tree becomes green via auto submit App c: contributor-productivity Team-specific productivity, code health, technical debt.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate android_semantics_testing to null safety

2 participants