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
updatesparameter torebuildmeans 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
voidreturning function makes it clear that you should not worry about the return value.