Closed bcko closed 6 years ago
And, you likely need an import 'dart:async';
now (https://travis-ci.org/dart-lang/dart2_fix/builds/383416131#L572), to reference the Future
.
Thank you for your help! :)
Thanks!
Forgive me for commenting on an already closed PR, but here's a bit of information that may be useful in similar situations:
The language team actually decided to allow an async method to have the return type void
, and the motivation is that this is a meaningful representation of the intent that invocations of that function should be a "fire and forget" operation: Callers should discard the returned future, and this means that they can't even synchronize on the completion of the associated task.
Considering an async main
, we actually have a good match for this description. The specification says nothing about how the returned value is used, and there is no support for claiming that the returned value is not ignored.
This means that we could make the case that void main() async {...}
is fine, and in the concrete context of this PR it also allows us to avoid an import.
PS: This is new, so the available tools may or may not have the feature implemented in any given context.
Awesome, thanks for the context and explanation @eernstg!
https://www.dartlang.org/guides/language/language-tour#the-main-function