1

I am making a quotes app with Flutter using Cloud Firestore as database. My problem is making a favorite quotes section for each user. I use the database global for everyone so I couldn't find a way to use it for marking quotes as favorite separately for each user. Must I use a local database or is there another way to do this?

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
mzeki
  • 33
  • 7

1 Answers1

1

If you are authenticating users:

When the user clicks on fav button, You can copy the id of quotes from the global database and save that in an individual user account in separate collection (For ID you can define it yourselves or use autogenerated one)

(this way you can save users data in the Firestore)

If you are Not authenticating users:

Check How can I save to local storage using Flutter?

UpaJah
  • 6,954
  • 4
  • 24
  • 30
  • Can you please open up the firestore option? Should I register every user? – mzeki Aug 05 '18 at 14:09
  • yeah, you can get UID using firebase authentication and save data in a users collection (but for a quotes app asking to register might create friction for your users.) – UpaJah Aug 05 '18 at 14:14
  • firebase auth has an anonymous auth provider. no reason not to use it, especially since it's straightforward. – blaneyneil Aug 05 '18 at 20:31
  • if I use anonymous auth will it be permanent as long as the app is installed or will it reset everytime a user opens the app? – mzeki Aug 06 '18 at 07:59
  • check: https://stackoverflow.com/questions/41733137/firebase-auth-anonymous-login – UpaJah Aug 06 '18 at 09:44