Search code examples
asynchronousdartchrome-dev-editor

Async/await dart support on Chrome Dev Editor


Dart recently added a support for async/await keywords: https://www.dartlang.org/articles/await-async/

I tried to run a simple code but Chrome Dev Editor does not recognise async keyword

import 'dart:async';

void main() async {
}

Am I doing something wrong (something to modify in the pubspec.yaml ?) or is it just that this feature is not supported yet on Chrome Dev Editor ?

Edit:

Ok, so for know it seem that async/await seems to be more an experimental feature:

https://www.dartlang.org/docs/dart-up-and-running/ch02.html#async-opt-in

To opt into asynchrony support in Dart Editor, go to Preferences, click Experimental, and select Enable Async Support.

In dart and dartanalyzer, use the --enable-async command-line flag:

dart --enable-async async_await.dart
dartanalyzer --enable-async async_await.dart

Unfortunatly, it seems only to work for Dart Editor, not CDE.

Also, dart does not currently support the conversion into javascript without adding a package:

dependencies:
  async_await:
    git: https://github.com/dart-lang/async_await.git
transformers:
- async_await

Solution

  • So currently it's not supported.

    Now there is an issue on this problem: https://github.com/dart-lang/chromedeveditor/issues/3822

    Thank you for all your answer

    Wait & see...