This file contains hidden or 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
// Sample Dart code for making parallel async calls. | |
void main() { | |
Future.wait([firstAsync(), secondAsync(), thirdAsync()]) | |
.then((List responses) => print("All tasks are done")) | |
.catchError((e) => print(e)); | |
} | |
Future firstAsync() async { |
This file contains hidden or 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
import 'dart:async'; | |
void main() { | |
Future<int>.delayed(Duration(seconds: 3), () { | |
return 100; | |
}).then((value) { | |
print(value); | |
}).then((value) { | |
throw Exception(); | |
}).catchError((exception) { |