Using --enable-async with a pub
I am using the new async / await syntax in my code and everything works fine if I launch my application directly from the dart using something like C:\dart\dart-sdk\bin\dart.exe --enable_async --checked C:\code\dart-app\main.dart
When I try to run pub run main.dart
in the same application, I get an error error: line XX pos XX: use flag --enable-async to enable async/await features
. The flag --enable-async
seems to be something like Dart himself, so I can't add it to the pub command. How can I create my app using pub in such a way that I can use the async / await syntax?
source to share
The command pub run
loads and executes the transformers registered in your pubspec.yaml file before executing the application. This way you can use the async-await transformer to process async / await instructions. See Dart 1.8 Async / Await Function
source to share