Sign in
Log inSign up
Pratik Butani

2 comments

Aman
Aman
May 3, 2023

Hi, I have a doubt about why you use Future.wait(userFutures), instead, we can await the future in the above line userFutures=await userIds.map((id) => getUserData(id));

1
·
·1 reply
Pratik Butani
Pratik Butani
Author
·Jul 19, 2023

Thank you for asking Aman.

Whenever you wants to get the response together from multiple things, you can use wait. It will wait for all the actions and once all the actions will complete their tasks, the Future.wait() will return the combined values.

·