averageCollection function
Averages field over what a query matches, computed by the server.
As with sumCollection, documents without a numeric value for the field are skipped — they do not pull the average toward zero. An empty result set has no average and answers 0.
Implementation
Future<double> averageCollection(
String collectionPath,
String field, {
List<Where> where = const [],
List<OrderBy> orderBy = const [],
int? limit,
int? limitToLast,
bool collectionGroup = false,
}) => _aggregate(
fdbFsAverage,
'average',
collectionPath,
field,
where: where,
orderBy: orderBy,
limit: limit,
limitToLast: limitToLast,
collectionGroup: collectionGroup,
);