main() async {
print('Hello World');
await getAsyncString().then((hello) => print(hello));
}
Future<String> getAsyncString() async {
return 'Hello Async World';
}
This is my code example, index.dart. It is in my web folder.
I run webdev build to compile to js.
When I run dart web/index.dart in my web folder
I get the expected output of
Hello World
Hello Async World
When I run node build/index.dart.js or index.js I only get
Hello World
Is the async code running and is this expected behavior?
The full output is too long to post.
Steps to reproduce:
touch testcompile.dart
add the code
dart2js -O2 -o index.js testcompile.dart
node index.js