count method

Future<int> count()

Executes an aggregation query to count the number of documents matching the query.

Implementation

Future<int> count() async {
  try {
    AggregateQuerySnapshot snapshot = await state.count().get();
    return snapshot.count ?? 0;
  } catch (e) {
    debugPrint("[[Error executing count aggregation]]: $e");
    return 0;
  }
}