TLDR: The versions of dart2js and dart in dev-69.1 issue some incorrect errors around void. These should be fixed in dev-69.2.
In the latest dev build (dart 2.0.0-dev.69.1), void usage errors are now enforced reported before running your dart programs:
void f() {}
print(f()); // error, you can't use the result of f()!
These have been reported in the analyzer for a few months now, and we believe this will catch bugs in your code and is a good change.
Unfortunately there were some bugs in the new voidness checks that are stricter than we had originally decided to do. Here are some examples:
Future f() async => voidFn(); // Inadvent error
when(voidFn()).thenReturn(...); // Inadvertent error
run(() { return voidFn(); }); // Inadvertent error
And some of these issues affect the package ecosystem:
package:analyzer must be upgraded to 0.32.4
package:coveralls is currently not in a workable state
This change has been rolled back and will be fixed in dev-69.2, which should be released shortly. In the meantime you can use dev.69.0, or you can, if you wish, fix your code to comply with the extra strict errors. However be aware that these will not be required after the next release.
There is one new error which you may newly see which is likely to be kept for dart 2, which you may also see. This was not reported before due to a bug:
void f() async {} // an async function that you should not await
await f(); // this is now reported as an error
If you have issues with this in your package, please let us know.
We recognize that the current state of void errors is a bit confusing with this release, compared to old ones, and trying to predict what that means going forward. Please reach out to me if you have any questions!
mfair...@google.com