final Firestore = FirebaseFirestore.instance.collection("users").doc();
i have a collection users in my database ,using flutter(Dart), can anyone show me how to write a function who count the Numbers of users in This collection and print It on a Dashboard? thank you
CodePudding user response:
static Future<int> totalFollowers({String userId}) async {
final collection = FirebaseFirestore.instance
.collection(ParamsArgus.COLLECTION_USERS)
.snapshots();
return collection.length;
}