I am using the below query to get documents before given documents snapshot. when I use descending: false I get initial 5 documents but I want immediate 5 documents before the given documents. When I use descending: true I get an empty list. Please help me. What I am doing wrong here.
Stream<QuerySnapshot> getConversationBefore(String currentUserID,String clientID,DocumentSnapshot documentSnapshot)
{
return Firestore.instance
.collection(FIREBASE_COLLECTION_MESSAGES)
.document(currentUserID)
.collection(clientID)
.orderBy(TIMESTAMP_FIELD, descending: false)
.endBeforeDocument(documentSnapshot)
.limit(5)
.snapshots();
}