I'm new to flutter. I am trying to get StorageUploadTask
status and have the Download when is status isCompleted
& isSuccessful
. The examples I found online are of the old version:
StorageUploadTask uploadTask = ref.putFile(avatarImageFile);
Uri downloadUrl = (await uploadTask.future).downloadUrl;
The above doesn't work for the new firebase_storage
plugin version. Please help. Below is my code so far.
StorageUploadTask uploadTask = ref.putFile(avatarImageFile);
StorageReference downRef = uploadTask.lastSnapshot.ref;
String downloadUrl = await downRef.getDownloadURL();
if(uploadTask.isComplete) {
if(uploadTask.isSuccessful) {
print('Upload Successful');
} else if(uploadTask.isCanceled) {
print('Upload Cancelled');
} else {
print('${uploadTask.lastSnapshot.error}');
}
} else if(uploadTask.isInProgress){
print('Upload in Progress');
} else if(uploadTask.isPaused) {
print('Upload Paused');
}