Skip to content

Instantly share code, notes, and snippets.

@JannieT
Created February 28, 2020 08:06
Show Gist options
  • Save JannieT/20ae2ced5f4d5dfc760339b4de6584f5 to your computer and use it in GitHub Desktop.
Save JannieT/20ae2ced5f4d5dfc760339b4de6584f5 to your computer and use it in GitHub Desktop.
import 'dart:async';
Future main() async {
print('start');
final futures = <Future>[
fetchLong(),
fetchShort(),
];
await Future.wait(futures);
print('all done');
}
Future<void> fetchShort() {
return Future.delayed(Duration(seconds: 4), () => print('Short!'));
}
Future<void> fetchLong() {
return Future.delayed(Duration(seconds: 5), () => print('Long!'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment