I need to get data from an array in Firestore.
I’m getting an error:
StateError (Bad state: field does not exist within the DocumentSnapshotPlatform)
when I run the following query on the firestore database:
Future getData() async {
await FirebaseFirestore.instance
.collection("users")
.get()
.then((QuerySnapshot? querySnapshot) {
querySnapshot!.docs.forEach((doc) {
alldata = doc["errors"];
});
});
}
How do I properly make this query?
2
Answers
Solved!
Try this instead :