Last active
April 26, 2019 20:09
-
-
Save legalcodes/ae087299aa57886e63b34ea1d1b3f9b2 to your computer and use it in GitHub Desktop.
async example 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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