Flutter simultaneous images upload
327
You can use them in a single future
final results = await Future.wait([
uploadFunction(image1)
uploadFunction(image2)
]);
you can start uploading all images without waiting for the previous one to complete await will be returned once both uploads are completed
Author by
Slaine06
22 y/o Italian guy passionate about programming and technology. Currently based in Seoul, South Korea.
Updated on November 27, 2022Comments
-
Slaine06 over 1 year
I need to upload a list of images into a storage, but I don't want to upload and await for every single image after the other, because it takes quite some time. I would like to upload them simultaneously, like in different threads. There is a way to do achieve multithreading with standard dart async? Or should I use Isolates? Do you have some sample code?
-
Slaine06 almost 3 yearsIt seems that this library just allows me to queue futures and execute them one after the other, it does not execute them simultaneously. Am I wrong?
-
Priyesh almost 3 yearsYes you are right but for the image uploading, i suggest you to use it to avoid await.
-
Slaine06 almost 3 yearsSorry but I don't think this can help me. I need to await for the upload, but I want to speed up the process by uploading simultaneously using different threads.
-
Priyesh almost 3 yearsOkay, Keep growing !