aggregateSum method
Executes an aggregation query to sum the values of a specified field.
Implementation
Future<num> aggregateSum(String field) async {
try {
AggregateQuerySnapshot snapshot = await state.aggregate(sum(field)).get();
return snapshot.getSum(field) ?? 0;
} catch (e) {
debugPrint("[[Error executing sum aggregation]]: $e");
return 0;
}
}