I am trying to get the data from "savedGoal" collection and somehow it is throwing error (NoSuchMethodError). However same script/syntax of code is working absolutely fine for another collection on same firebase project. Please let me know what could be wrong here. Here is the script that I am running in ininState()-
FirebaseFirestore.instance
.collection("savedGoals")
.where('uid', isEqualTo: FirebaseAuth.instance.currentUser.uid)
.get()
.then((value) {
value.docs.forEach((result) async {
if (result.data().isNotEmpty) {
setState(() {
goalAmount = result.data()['goalAmountFixed'];
});
}
Here is the screenshot of error that I am receiving while using "savedGoal" collection - enter image description here
Here is the firebase document screenshot- enter image description here