-
Notifications
You must be signed in to change notification settings - Fork 184
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
Makes rebuild
take a void function.
#1096
base: master
Are you sure you want to change the base?
Conversation
It's not very clear whether a value returned by the `updates` parameter to `rebuild` means anything. All examples use `=>` notation which returns the builder. The return type is currently `dynamic`, which *suggests* that the value is used for something, potentially something which cannot even be typed. Marking the parameter as a `void` returning function makes it clear that you should not worry about the return value.
Yes, this is an improvement :) ... originally I left off 'void' to make the code more concise. That was in the Dart 1 days when it didn't make much difference :) Is this a breaking change, or should it still work if someone passes a function that returns something? Breaking changes to this library cause quite a lot of churn. I'll check it in google3, anyway. Thanks :) |
A The only issue could be non- o.rebuild((b) {
b.a = 42;
b.b = 37;
return 42;
}); Here the That said, someone as confused as me, and having looked at example code which all uses o.rebuild((b) {
b.a = 42;
b.b = 37;
return b;
}); just to be safe. And since it was accepted, they'd probably think it was the right thing to do. (An |
I agree, this is breaking but likely only hitting a very small percentage. Well worth it for better typing. |
Any interest in picking this back up/merging? I just ran into a small case where it would've been nice to avoid the dynamic typing here! |
Thanks for pinging Will. I'd have to release as a major version increase, i.e. Note to self: we actually cleaned up google3 for violations and apply this change as a patch; there were a nontrivial number of violations, so I expect there are violations in the wild, too; they were of the form |
It's not very clear whether a value returned by the
updates
parameter torebuild
means anything.All examples use
=>
notation which returns the builder. The return type is currentlydynamic
, which suggests that the value is used for something, potentially something which cannot even be typed.Marking the parameter as a
void
returning function makes it clear that you should not worry about the return value.