vedartm / paginate_firestore

A flutter package to simplify pagination with firestore data 🗃
https://pub.dev/packages/paginate_firestore
MIT License
113 stars 138 forks source link

Error when using "isNotEqualTo" operator is the Firestore querry. #155

Open ben55j opened 1 year ago

ben55j commented 1 year ago

Hello,

I get on error when using the "isNotEqualTo" in the querry for comparing 2 strings values. Here is the querry line, Knowing that "ownerUid" is a string field in my groups collection: query: FirebaseFirestore.instance.collection("groups").where("ownerUid", isNotEqualTo: "abcde12456").orderBy("createdDate"), Here the error I get from the console: ════════ Exception caught by widgets library ═══════════════════════════════════ The following assertion was thrown building ScreenInvitations(dirty, state: _ScreenInvitationsState#d8dc3): The initial orderBy() field "[[FieldPath([createdDate]), false]][0][0]" has to be the same as the where() field parameter "FieldPath([ownerUid])" when an inequality operator is invoked. 'package:cloud_firestore/src/query.dart': query.dart:1 Failed assertion: line 489 pos 13: 'conditionField == orders[0][0]'

I am using : kr_paginate_firestore: ^1.0.1

AdnanKhan45 commented 1 year ago

Hello ben55j,

I think the solution I'm about to provide is late but it might help others if you've already fixed it.

While using inEquality in query it's compulsry to use orderBy as displayed in the README.md.

firebaseFirestore.collection(FirebaseCollectionConst.users) .where("uid", isNotEqualTo: uid) .orderBy("uid")