TLDR: We are soliciting feedback on the proposal to disallow return a `void` typed value from a function whose return type is not `void`.
The original Dart 2 proposal for the treatment of `void` attempted to prevent `void` typed values from being accidentally used. See here for details on the proposal:
https://github.com/dart-lang/sdk/issues/30597 . When we prototyped this proposal, we felt that some of the proposed restrictions were too intrusive. We recently landed a subset of these restrictions (announced on flutter-dev here:
https://groups.google.com/forum/#!topic/flutter-dev/scnh7SfYa_o). We are proposing to add one additional restriction, based on our observation that fixing code broken by the change is relatively benign, and that it has essentially no impact on flutter framework code.
What is the proposed change?
In Dart 1, it was legal to return a `void` typed value from a function with return type `dynamic`. This is occasionally done implicitly (where the return type is left off the function) and only very infrequently done explicitly.
```dart
void returnsVoid() {}
// Occasionally seen
implicitDynamic() => returnsVoid();
// Rare
dynamic explicitDynamic() => returnsVoid();
```
We are proposing to make both of these uses an error, and are soliciting feedback from the community about the impact and desirability of these changes.
What should I do?
If you are opposed to this change, either because you feel it's a bad change, or because you feel that it will break too much of your existing code, please provide feedback here, on the issue linked above, or to me directly.
What should I expect to happen next?
If the sense of the community is that this change is worthwhile, we will send a breaking change announcement and land the new restrictions. If the overall sense is that catching these issues is not worth the breakage in existing code, we will abandon this proposal.
Please feel free to reach out to me with questions or feedback.
thanks,
-leaf