1

I'm developing an online shopping app, I want to check if the product in the user's wishlist/favorite list or not.

To read all products from firestore I used a stream getter method in a DatabaseService class that reads all products and then maps to the Product Model. In the Home screen I used StreamProvider<List>.value(....) and then in the display section (where I want to display products) I said:

final products = Provider.of<List<Product>>(context);

and then I used a grid view builder to display all products. it worked well. But I want to check if this product in the user's favorite list / wishlist, how can I know??

I tried many ways but it does not worked

D. Rohan
  • 23
  • 4
  • Where you are saving favoritelist/wishlist is it on firebase or locally? – Syed Ibrahim Feb 08 '23 at 06:06
  • on the firebase firestore – D. Rohan Feb 08 '23 at 08:14
  • first you have to get all products from your favlist and save it locally , then whenever you are calling products you can check from you local product list. And other thing is you have to call favlist and then product list then when you bind it to display check it with favlist. you should make one unique id to differ products so that you can check easily. – Syed Ibrahim Feb 08 '23 at 09:07
  • Did you see [How do I join data from two Firestore collections in Flutter?](https://stackoverflow.com/questions/59061225/how-do-i-join-data-from-two-firestore-collections-in-flutter) – Frank van Puffelen Feb 08 '23 at 15:25
  • Yes, but I didn't find the solution – D. Rohan Feb 09 '23 at 04:00

0 Answers0