QuerySnapshot returning null in Flutter web app but gives result in the Android console #6815
Unanswered
RogerantTshibangu
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
HI Guys,
I am having an issue where the QuerySnashot from the firestore giving correct value when printing in the android console but returns a null when building it on the flutter web app. Can someone please assist on what I am doing wrong?
Here is the function (returning the correct result):
countDrivers() async {
String collection = "drivers";
QuerySnapshot _myDoc = await firebaseFiretore.collection(collection).get();
List _myDocCount = _myDoc.docs;
print("Number of Drivers: ");
print(_myDocCount.length); // Count of Document
totaldriver = _myDocCount.length.toString() ;// counts the collection
print(totaldriver);
}
and here is how I am calling it on the web app (getting a null return)
InfoCard(
title: "Number of Drivers",
value: totaldriver.toString(),
topColor: Colors.lightGreen,
onTap: () {},
),
Beta Was this translation helpful? Give feedback.
All reactions