-
Notifications
You must be signed in to change notification settings - Fork 28.7k
Some widgets' nullOk parameters are inconsistently applied. #68637
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
Comments
The name of the parameter is consistent across many different similar static methods, not just I agree that the behavior should be mentioned more explicitly in the docs. |
I took a look at all of those, and it appears they are designed to throw regardless of whether asserts are enabled (although |
Ahh, I see what you mean. OK, I can see making those throw a We seem to actually be quite inconsistent with our methods that take |
Couldn't hurt. :) Thanks! |
I'm converting this issue over to cover all the static methods that take a We have a bunch of static member functions that have a |
Thanks Greg. When the time comes, I'd love to be CC'd on that PR if you get a chance. |
Sure, will do. |
Related: #67163 |
Here's a design doc for doing this: https://flutter.dev/go/eliminating-nullok-paramters (I know, I'm fixing the name typo in the go link). |
FYI, in discussions about this, @Hixie was of the opinion (and I agree) that eventually the |
Makes sense. Would exceptions without messages be thrown in the non-assert case? |
@shyndman Yes, and I added wording to that effect in the docs. |
This is all done, except for |
Thanks! It's one of those things where a few people will never realize the thanks they owe — the bug they didn't have to track down. :) |
There's one more nullOK param remaining after all changes linked from this bug are submitted: https://master-api.flutter.dev/flutter/widgets/Actions/invoke.html |
I'll fix the |
Thanks Greg |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
The
Actions
widget has a number of static methods with anullOk
parameter, which can be used to enable or disable the throwing of errors when the caller's requested object was not found.Turns out, this parameter is only considered when asserts are enabled. This feels a little iffy to me, as the documentation makes no mention of how the contract can change depending on environment.
Request: Improve docs (and maybe the name of the param, since it's sort of a debug only thing), or alternatively normalize behavior between asserts-enabled and disabled builds.
Affected methods:
Actions.find
Actions.of
Actions.handler
Actions.invoke
Thanks!
@gspencergoog
The text was updated successfully, but these errors were encountered: