0
try {
      DocumentReference ref = FirebaseFirestore.instance
          .collection('invoices')
          .doc(authService.getUser().uid);

      final doc = await ref.get();
      final data = doc.data();

      Map savedCompanyInfo = data != null ? data as Map<String, dynamic> : {};
      myRents.companyInfo = savedCompanyInfo;

      return savedCompanyInfo;
    } catch (e) {
      return {};
    }

working code locally (emulator and real device) but not in released app. It goes into the catch.

Working on iOS also recently on Android, since I updated to Flutter 2.8

Dani
  • 3,128
  • 2
  • 43
  • 91
  • Did you add the release sha-1 from google play to Firebase? Or you may have an issue with proguard like this question https://stackoverflow.com/questions/50044560/firestore-app-works-in-debug-but-signed-apk-gives-error/59626147#59626147 – Scott Dec 18 '21 at 20:27
  • And what is the exception? – Riwen Dec 18 '21 at 20:52
  • Yes, sha-1 is added to Firebase and google-services.json is updated. As mentioned this was working before updating Flutter. How can I know if I have an issue with proguard. I don't know about the exception either. Any way to check that out from released apk? – Dani Dec 18 '21 at 22:58
  • catch(e){ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(e)));} – Scott Dec 18 '21 at 23:36
  • I had to connect a real device, install a release apk and run flutter logs to check this out. Apparently I'm getting something like [cloud_firestore/unavailable] The service is currently unavailable that I'm investigating. I did not get this at all before Flutter 2.8 – Dani Dec 19 '21 at 00:25

1 Answers1

1
release {
            signingConfig signingConfigs.release
            minifyEnabled false // this was true before
        }
Dani
  • 3,128
  • 2
  • 43
  • 91