34

Is there an existing API to group a list of Future object into one so that I can wait for all to complete? Like in javascript's Promise.all.

nyarian
  • 4,085
  • 1
  • 19
  • 51

2 Answers2

45

You can use the Future.wait method documented here:

https://api.dart.dev/stable/dart-async/Future/wait.html

julemand101
  • 28,470
  • 5
  • 52
  • 48
24

You can use Future.wait

Example

var futures = await Future.wait([     
      getAddress(),      
      getTeam(),    
      getEvents(),
    ]);
Anoop Thiruonam
  • 2,567
  • 2
  • 28
  • 48