Skip to content

Instantly share code, notes, and snippets.

@phyowaikyaw-mobiledev
Created April 6, 2026 12:09
Show Gist options
  • Select an option

  • Save phyowaikyaw-mobiledev/657988df3d83ae2a87bd35214ab8bf4b to your computer and use it in GitHub Desktop.

Select an option

Save phyowaikyaw-mobiledev/657988df3d83ae2a87bd35214ab8bf4b to your computer and use it in GitHub Desktop.
Assignment 19 - Async Programming with Future.wait
import 'dart:async';
Future<int> getNumber1() async {
await Future.delayed(Duration(seconds: 3));
return 10;
}
Future<int> getNumber2() async {
await Future.delayed(Duration(seconds: 2));
return 20;
}
void main() async {
final result = (await Future.wait([getNumber1(), getNumber2()])).reduce((a, b) => a + b);
print(result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment