AggregateQuery class
A query that calculates aggregations over the documents of a Query without downloading the documents themselves.
Create one with Query.count, Query.aggregate or
Query.aggregateWithAliases, then call get.
final AggregateQuerySnapshot snapshot =
await firestore.collection('cities').count().get();
print(snapshot.count);
An aggregation is a single request to the server: the local cache is
neither used nor updated, the result does not include writes that are
still pending, and there is no listener for it. In a read-only
transaction, run it with Transaction.getAggregate.
Properties
-
aggregateFields
→ List<
AggregateField> -
The aggregations requested by this query.
final
-
aliases
→ Map<
String, AggregateField> ? -
The user-chosen aliases of the aggregations, or null when the query was
created from a list of fields.
AggregateQuerySnapshot.datais keyed by these aliases when they are present.final - hashCode → int
-
The hash code for this object.
no setteroverride
-
query
→ Query<
Object?> -
The query whose result set is aggregated.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
get(
{AggregateSource source = AggregateSource.server}) → Future< AggregateQuerySnapshot> - Executes the aggregation on the server and returns the results.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override