Skip to content

Commit 714a853

Browse files
docs(cloud_firestore): fixing example code in aggregation sum
1 parent f674af1 commit 714a853

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/firebase_snippets_app/lib/snippets/firestore.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ class FirestoreSnippets extends DocSnippet {
888888
void aggregationQuery_sum() {
889889
// [START sum_aggregate_collection]
890890
db.collection("cities").aggregate(sum("population")).get().then(
891-
(res) => print(res.getAverage("population")),
891+
(res) => print(res.getSum("population")),
892892
onError: (e) => print("Error completing: $e"),
893893
);
894894
// [END sum_aggregate_collection]
@@ -902,7 +902,7 @@ class FirestoreSnippets extends DocSnippet {
902902
.aggregate(sum("population"))
903903
.get()
904904
.then(
905-
(res) => print(res.getAverage("population")),
905+
(res) => print(res.getSum("population")),
906906
onError: (e) => print("Error completing: $e"),
907907
);
908908
// [END sum_aggregate_query]

0 commit comments

Comments
 (0)