Skip to content

Instantly share code, notes, and snippets.

View samramez's full-sized avatar
🤞

Sam Ramezanli samramez

🤞
View GitHub Profile
// 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 {
@samramez
samramez / future_example.dart
Created March 15, 2020 16:13
Simple practice code for using Dart Future object.
import 'dart:async';
void main() {
Future<int>.delayed(Duration(seconds: 3), () {
return 100;
}).then((value) {
print(value);
}).then((value) {
throw Exception();
}).catchError((exception) {