Jus10
Jus10

Reputation: 15679

Flutter OnProgressListener for firebase_storage?

How can we listen to the progress of a file upload to Firebase Storage in Flutter?

Upvotes: 2

Views: 1223

Answers (1)

Tree
Tree

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

Related Questions