Last active
November 19, 2021 18:10
-
-
Save abbondanza/6c099a598a2fbfcc6db45da871bcec02 to your computer and use it in GitHub Desktop.
Async Dart
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
void main() async { | |
final delayed3 = Future.delayed( | |
const Duration(seconds: 3), | |
() => '3', | |
); | |
final delayed2 = Future.delayed( | |
const Duration(seconds: 2), | |
() => '2', | |
); | |
final delayed1 = Future.delayed( | |
const Duration(seconds: 1), | |
() => '1', | |
); | |
await Future.wait([ | |
delayed3.then(print), | |
delayed2.then(print), | |
delayed1.then(print) | |
]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment