Skip to content

Commit 7ec2d5c

Browse files
authored
Update firestore.dart to fix pagination with document snapshot
When paginating you can either pass an array of field values for. the cursor document, or you can pass a single `DocumentSnapshot` object. The code samples for using a `DocumentSnapshot` call the wrong function, and this PR fixes that.
1 parent 4c09819 commit 7ec2d5c

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
@@ -929,7 +929,7 @@ class FirestoreSnippets extends DocSnippet {
929929
final biggerThanSf = db
930930
.collection("cities")
931931
.orderBy("population")
932-
.startAt([documentSnapshot]);
932+
.startAtDocument(documentSnapshot);
933933
},
934934
onError: (e) => print("Error: $e"),
935935
);
@@ -951,7 +951,7 @@ class FirestoreSnippets extends DocSnippet {
951951
final next = db
952952
.collection("cities")
953953
.orderBy("population")
954-
.startAfter([lastVisible]).limit(25);
954+
.startAfterDocument(lastVisible).limit(25);
955955

956956
// Use the query for pagination
957957
// ...

0 commit comments

Comments
 (0)