Skip to content

Instantly share code, notes, and snippets.

@legalcodes
Last active April 26, 2019 20:09
Show Gist options
  • Save legalcodes/ae087299aa57886e63b34ea1d1b3f9b2 to your computer and use it in GitHub Desktop.
Save legalcodes/ae087299aa57886e63b34ea1d1b3f9b2 to your computer and use it in GitHub Desktop.
async example 1
// Synchronous code
String createOrderMessage () {
var order = getUserOrder();
return 'Your order is: $order';
}
// Asynchronous code
Future getUserOrder() {
return Future.delayed(Duration(seconds: 4), () => 'Large Latte');
}
main() {
print(createOrderMessage());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment