Skip to content

Instantly share code, notes, and snippets.

@legalcodes
Last active November 25, 2019 23:23
Show Gist options
  • Save legalcodes/57e6085344cbd1719ed42b32f8ad1bce to your computer and use it in GitHub Desktop.
Save legalcodes/57e6085344cbd1719ed42b32f8ad1bce to your computer and use it in GitHub Desktop.
What is a future? (completed)
Future<void> fetchUserOrder() {
// Imagine that this function is fetching user info from another service or database
return Future.delayed(Duration(seconds: 3), () => print('Large Latte'));
}
void main() {
fetchUserOrder();
print('Fetching user order...');
}
@galeyang
Copy link

galeyang commented Aug 2, 2019

Comment in line 2 says user info, but code in line 3 is about user order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment