Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filtering & Sorting Firebase (Firestore) Data on a Flutter App

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.

like image 234
Shaurya Jain Avatar asked Jun 11 '18 19:06

Shaurya Jain


1 Answers

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

like image 63
Rohan Taneja Avatar answered Sep 26 '22 11:09

Rohan Taneja