Ad
Flutter: Stuck Getting Collection From Firestore
DocumentReference ref = FirebaseFirestore.instance
.collection('invoices')
.doc(authService.getUser().uid); // or non existing ID
// here works if I return {}
final doc = await ref.get();
final data = doc.data();
When trying locally either with simulator or with real device (connected by usb) works fine, but in released app, the await takes for ever.
This was also working ok before updating to flutter 2.8 but now it fails only on Android
Ad
Answer
Reposting my comments as they seemed to have helped:
You should handle possible exceptions. The get
method returns an instance of Future
, which may complete with an error. When awaiting it, it may throw.
Ad
source: stackoverflow.com
Related Questions
- → How can I query Firebase for an equalTo boolean parameter?
- → How can I access nested data in Firebase with React?
- → Firebase simple blog (confused with security rules)
- → Removing item in Firebase with React, re-render returns item undefined
- → AngularJS Unknown Provider Error (Firebase & AngularFire)
- → How do you pass top level component state down to Routes using react-router?
- → "this" is null in firebase query function in reactjs
- → Angular Module Failed to Load
- → Multiple dex files define Lcom/google/android/gms/internal/zzrx;
- → Joining Firebase tables in React
- → How can I make add firepad to my reactjs project?
- → How to use Cloud Functions for Firebase to prerender pages for SEO?
- → React.js component has null state?
Ad