Skip to content

Connection error doesnt respond as onError #22

@worldwidee

Description

@worldwidee

WhatsApp Image 2022-01-30 at 23 40 20
WhatsApp Image 2022-01-30 at 23 37 48

Sometimes i get these errors while uploading data to firebase storage. However when i put UploadTask in try catch block, catch part doesnt work and also when i listen uploadtask onError part doesnt work too. For example it doesnt print "upload get err1 or err2".

try {
      uploadTask = ref.putData(File(file.filePath).readAsBytesSync());
      await uploadTask.snapshotEvents.listen((snapshot) {
        uploadingValue =
            ((snapshot.bytesTransferred / snapshot.totalBytes) * 100).toInt() /
                100;
        print('Progress: %${uploadingValue * 100}');
      }, onDone: () async {
        print("UPLOAD DONE!!!");
        print("uploadFail:$cloudFail");
        if (!cloudFail) {
          setState(() {
            uploaded = true;
          });
          await triggerStorageFiles();
          saveDb();
        }
      }, onError: (e) {
        print("upload get err1:$e");
        cancellUpload();
        cloudFail = true;
        saveDb();
      });
    } catch (e) {
      print("upload get err2:$e");
    }

By the way its happening while connected wifi. I dont get this err when i connected with cable.

Edit:
same error
Unhandled Exception: SocketException: OS Error: Operation timed out, errno = 60, address = firebasestorage.googleapis.com, port = 51294
its happening while uploading big file or 20-30 small files. So i think its becoming timed out with wifi connection. How can i fix it :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions