Fallowing code include two Network Request which is running Asynchronous, I want to run them parallel and get their result to compare before moving to next code.
final failureOrGovernate = await getGovernateDataUsecase();
final failureOrArea = await getAreaDataUsecase();
Thank You, your comments and answers are highly appreciated.
You can wait on multiple futures in parallel with Future.wait()
final both = await Future.wait([getGovernateDataUsecase(), getAreaDataUsecase()]);
final failureOrGovernate = both[0];
final failureOrArea = both[1];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.