Reputation: 15679
How can we listen to the progress of a file upload to Firebase Storage in Flutter?
Upvotes: 2
Views: 1223
Reputation: 31371
If your upload function is async you can do it like this
StorageUploadTask putFile =
storage.ref().child("folder/$fileName").putFile(file);
putFile.future.catchError(onError);
UploadTaskSnapshot uploadSnapshot = await putFile.future;
print("file uploaded");
After the future resolves, the file is uploaded.
Upvotes: 1