Skip to content

Instantly share code, notes, and snippets.

@bmatheus91
Created September 24, 2019 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bmatheus91/b3aac14e941449bb18609f77a8a8f8ab to your computer and use it in GitHub Desktop.
Save bmatheus91/b3aac14e941449bb18609f77a8a8f8ab to your computer and use it in GitHub Desktop.
Example with futures
void main() async {
test().then((value) {
print(value);
});
print(2);
await Future.delayed(Duration(seconds:2), () {
print(3);
});
print(4);
}
Future<int> test() async {
await Future.delayed(Duration(seconds:2));
return 1;
}
@AmirChGit
Copy link

ntm

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