I have id list like this;
List<dynamic> saveIDList = [];
The values ββin this list change according to the id saved by the user.
I try to show the posts saved by the user. So I create a query like this;
Query saveIDRef = _firestore
.collectionGroup("Posts")
.where("postID", whereIn: saveIDList);
After creating this query, I call the saveIDRef in the stream builder. So far, there is no problem in my code, it works properly, but when the length of the saveIDlist exceeds 10, I get a warning.
It is not possible for me to change my database form or the way I query my saveIDList, how can I solve this problem?
I tried different solutions but it didn't work.
For Example I create chunk list like this;
var chunks = [];
for (var i = 0; i < saveIDList.length; i += 10) {
chunks.add(saveIDList.sublist(
i, i + 10 > saveIDList.length ? saveIDList.length : i + 10));
}
and I seperated values in saveIDList then I used chunks in whereIN query like this;
Query saveIDRef = _firestore
.collectionGroup("Posts")
.where("postID", whereIn: chunks);
But that didn't work either. When I query chunks list like this;
Query saveIDRef = _firestore
.collectionGroup("Posts")
.where("postID", whereIn: chunks[0]);
it works. But I want to Query all elements in chunks list not the only first element of chunks list. When I put this code in to the for loop, I get error of whereIN query cannot use more than once.