Skip to content

Instantly share code, notes, and snippets.

@fengyfei
Created May 21, 2019 07:33
Show Gist options
  • Save fengyfei/68e7b1bf402161214a3bfa39a1e980dc to your computer and use it in GitHub Desktop.
Save fengyfei/68e7b1bf402161214a3bfa39a1e980dc to your computer and use it in GitHub Desktop.
[dart:async] Await a Future
import 'dart:async';
main() async {
Future<int> future = Future(() => 1024);
try {
print(await future);
} catch(err) {
print(err);
}
print("Finished!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment