You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
The language specification specifies that
await e
is an error whene
has static typevoid
: There is a list of exceptions where a void expression can be used, andawait 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 whene
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 lintawait_only_futures
will also flag it.This means that we should add
await e
as an additional exception in sectionType 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).The text was updated successfully, but these errors were encountered: