Home > OS >  Flutter Firebase storage upload takes too long but only on IOS
Flutter Firebase storage upload takes too long but only on IOS

Time:11-08

I'm working on an upload feature for my application for both android and ios and I'm using Firebase Storage for that. I'm uploading small images which sizes barely exceed 100kb. Everything works great on my android device but for some reason my ios won't work as intended. Here's the code in question :

      final snapshot = await _firebaseStorage
          .ref()
          .child("$profilePicsFolder/$fileName")
          .putFile(resImg);
      final String imgUrl = await snapshot.ref.getDownloadURL();
      await auth.updateUserProfilePicture(photoUrl: imgUrl);

The problem here is that the putFile() takes forever on ios, but on android it barely takes a couple of seconds. And I noticed that even though the execution is still waiting on the putFile() fuction for minutes, when I check Firebase storage directly I notice that the file gets uploaded almost instantly.

Not sure what I'm doing wrong here.

CodePudding user response:

Using putData() instead of putFile() in IOS applications will help to resolve these kinds of problems.

  • Related