'Flutter: How to fetch a particular record from firebase
This is the screenshot of my database.
I want to fetch the record for a particular username. (For eg: where [email protected]) Can anyone suggest to me how to fetch this in flutter?
It would be a great help, Thank you.
Solution 1:[1]
you can try this approach it helped me, but if you have migrated to null safety just make sure that you change the code accordingly
Solution 2:[2]
You can try the following query to get your result.
FirebaseFirestore.instance
.collection('your-collection-name')
.where('user', arrayContains: '[email protected]')
.get();
Solution 3:[3]
For android solution follow this:
FirebaseFirestore.getInstance()
.collection("users").whereArrayContains("user","[email protected]").get();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Rishab Sharma |
| Solution 2 | Ashok Kuvaraja |
| Solution 3 | Waseem Khan |

