getSum method

double? getSum(
  1. String field
)

Retrieves the sum value for the specified field from the aggregation data.

Parameters:

  • field: The field name to get the sum for.

Returns: The sum value as a double, or null if not available.

Example:

double? total = snapshot.getSum('price');

Implementation

double? getSum(String field) {
  return data[field].toDouble();
}