Reputation: 71
If my user database is on Firestore and on Registration I ask each users a set of few questions (checkboxes, radio buttons, etc). I want to create a Filter and Sort mechanism where a user is able to filter and sort a list of other users (from Firestore) based on multiple filter parameters sorted according to a particular field.
Is what I want to create even possible on Firebase (FireStore) and Flutter or do I need anything else?
Can anybody please link me to any relating Flutter/Firebase documentation, YouTube videos, or any other relevant content.
Upvotes: 7
Views: 4272
Reputation: 96
You can create multiple filter and ordering in firestore in flutter app.
QuerySnapshot orderQuerySnapshot = await orderCollection
.where("status", isEqualTo: status)
.where("timestamp", isGreaterThanOrEqualTo: lowerDate)
.where("timestamp", isLessThanOrEqualTo: upperDate)
.orderBy('timestamp', descending: true)
.get();
Upvotes: 0
Reputation: 10667
Once you fetch your list of users from Firestore, you can easily sort and filter them using the methods provided by the List
class in Flutter:
sort
method for sorting: https://docs.flutter.io/flutter/dart-core/List/sort.html
retainWhere
method for filtering: https://docs.flutter.io/flutter/dart-core/List/retainWhere.html
Upvotes: 1