Created
May 3, 2022 12:48
-
-
Save marcel-ploch/664a3fc188d694d5b1644774d09d6922 to your computer and use it in GitHub Desktop.
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
Future<void> printOrderMessage() async { | |
print('Awaiting user order...'); | |
var order = await fetchUserOrder(); | |
print('Your order is: $order'); | |
} | |
Future<String> fetchUserOrder() { | |
// Imagine that this function is more complex and slow. | |
return Future.delayed(const Duration(seconds: 4), () => 'Large Latte'); | |
} | |
void main() async { | |
await printOrderMessage(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment