I'm trying to prepare for the inevitability of when a user uploads to firebase storage but doesn't have an internet connection. Currently, if i use the following and turn of all internet connections it never reaches the catchError
it just waits and prints the dowloadUrl when the connection comes back.
FirebaseStorage.instance.setMaxOperationRetryTimeMillis(10);
final StorageReference ref = FirebaseStorage.instance.ref().child("AllUsers").child(uuid).child(fileName);
final StorageUploadTask uploadTask = ref.putFile(image, const StorageMetadata(contentLanguage: "en"));
Uri downloadUrl;
await uploadTask.future.then( (UploadTaskSnapshot snapshot) {
downloadUrl = snapshot.downloadUrl;
print(downloadUrl)
}).catchError((error) {
print(error);
});
Does this mean I don't have to worry about caching each image for upload later and that it's being handled? I'm assuming not but that would be great.
Update:
Adding this instead of the then catch:
try {
downloadUrl = (await uploadTask.future).downloadUrl;
print("$downloadUrl");
} catch (error) {
print(error);
}
didnt make the call after the request.
Update 2:
Tried adding the following:
FirebaseStorage.instance.setMaxUploadRetryTimeMillis(10);
FirebaseStorage.instance.setMaxOperationRetryTimeMillis(10);
FirebaseStorage.instance.setMaxDownloadRetryTimeMillis(10);
which returns E/StorageException(13068): The operation retry limit has been exceeded.
but through the console and not caught as an error in my catchError
or try catch
block.