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
You should probably be allowed to not return, or use return; , with a return type of either voidorFutureOr<void> (or FutureOr<FutureOr<void>>, etc).
Maybe something like:
A type is "voidable" if it is void or it is FutureOr<T> and T is voidable. It's an error if a function body contains return; or can reach the end of the body without throwing or returning, unless the function's return type is voidable. It is an error if a function body contains return expr; and the function's return type is void.
The FutureOr<void> type is a little tricky. Any value can be assigned to it, so it's not that different from dynamic, void or Object, and it's not void. There are operations you can do on it - it's just that if it\s not Future<void>, you're not supposed to use it.
a-siva
added
the
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
label
Nov 9, 2017
As of
dev-6.0
:... lints the
return
statement with:If I change it to
return null;
, the warning goes away. Interestingly enough,Future<Null>
is fine:On a related note - what is the status ofFuture<void>
? I didn't try compiling/running the code.EDIT: Thanks @munificent - I see that full support is not planned until after the FE migration.
The text was updated successfully, but these errors were encountered: