Skip to content

Instantly share code, notes, and snippets.

@torstenek
Created February 23, 2020 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torstenek/dcf684e3857f951eaac0cf9ccd9aa792 to your computer and use it in GitHub Desktop.
Save torstenek/dcf684e3857f951eaac0cf9ccd9aa792 to your computer and use it in GitHub Desktop.
Future<String> fetchUserOrder() =>
// Imagine that this function is
// more complex and slow.
Future.delayed(
Duration(seconds: 2),
() => 'Large Latte',
);
void main() async {
var order = await fetchUserOrder();
print(order);
fetchUserOrder().then(
(order) => print('Your order is: $order')
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment