Description
The language specification specifies that await e
is an error when e
has static type void
: There is a list of exceptions where a void expression can be used, and await e
is not in this list.
However, this error was not implemented when Dart 2 was released, and we decided to allow await e
even when e
is void, in order to avoid a substantial amount of breakage. Cf. this comment and this one.
It may still be targeted using a --strict-await
option on the analyzer, cf. dart-lang/sdk#33823, and the lint await_only_futures
will also flag it.
This means that we should add await e
as an additional exception in section Type Void
, such that this is no longer an error. We may wish to mention that it is bad code, and there are ways to detect it (except that the spec doesn't otherwise mention lints).