getAverage method
- String field
Retrieves the average value for the specified field from the aggregation data.
Parameters:
field: The field name to get the average for.
Returns: The average value as a double, or null if not available.
Example:
double? avg = snapshot.getAverage('price');
Implementation
double? getAverage(String field) {
return data[field].toDouble();
}