sum static method
Creates an AggregateField that sums the values of field over the
documents in the result set.
Non-numeric values are ignored. The result is an integer unless a double value takes part in the sum or the integer sum overflows, in which case it is a double.
field is a String, a dot-separated field path ('price.net' is net
inside price), or a FieldPath; it throws an ArgumentError if it is
not a valid path.
final AggregateQuerySnapshot result = await firestore
.collection('orders')
.aggregate(<AggregateField>[AggregateField.sum('total')])
.get();
final num? total = result.getSum('total');
Implementation
static SumAggregateField sum(Object field) =>
SumAggregateField._(_fieldPathOf('sum', field));