countWhere method
Gets the amount of documents filtered by the provided clauses.
Uses the count feature introduced in v4.0.0 of cloud_firestore
to count
documents on the server without retrieving documents.
Firestore Release Notes
Cloud Firestore now supports a count() aggregation query that allows you to determine the number of documents in a collection. The server calculates the count, and transmits only the result, a single integer, back to your app, saving on both billed document reads and bytes transferred, compared to executing the full query.
Source: https://firebase.google.com/support/releases#firestore-count-queries
See also: countAll
Implementation
@override
Future<int> countWhere(List<Clause> clauses) async {
final snapshot = await untypedRef.filter(clauses).count().get();
return snapshot.count ?? 0;
}