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
.
Asked
Active
Viewed 1.4k times
34

nyarian
- 4,085
- 1
- 19
- 51
-
1Something like Future.wait? https://api.dart.dev/stable/2.5.0/dart-async/Future/wait.html – julemand101 Sep 11 '19 at 12:32
-
definitely something like this, please fire an answer – nyarian Sep 11 '19 at 12:34
-
Related question: https://stackoverflow.com/q/42176092/9157799 – M Imam Pratama Jan 30 '22 at 14:12
2 Answers
24
You can use Future.wait
Example
var futures = await Future.wait([
getAddress(),
getTeam(),
getEvents(),
]);

Anoop Thiruonam
- 2,567
- 2
- 28
- 48