uploadFileWithProgress method
UploadTask
uploadFileWithProgress({})
Uploads a File and exposes a TaskSnapshot stream to track progress.
Listen to the stream to update a progress bar, then await the
returned UploadTask for the final TaskSnapshot.
Example:
final task = BaiomyStorageRepo.instance.uploadFileWithProgress(
path: 'videos/intro.mp4',
file: videoFile,
);
task.snapshotEvents.listen((snapshot) {
final progress = snapshot.bytesTransferred / snapshot.totalBytes;
print('${(progress * 100).toStringAsFixed(1)} %');
});
final snapshot = await task;
final url = await snapshot.ref.getDownloadURL();
Implementation
UploadTask uploadFileWithProgress({
required String path,
required File file,
SettableMetadata? metadata,
}) => _ref(path).putFile(file, metadata);