Creating a Flutter/Firebase non-authenticated user favorite list?

Is it possible to create a Flutter/Firebase non-authenticated user favorite list?
I am making a greeting cards app where I store the greeting cards in firebase storage and retrieve them from there. But I am having difficult time figuring out how can a non-authenticated user can favorite a card and view it in a favorites screen. I would be grateful if someone can give me hints on how to accomplish this.

Hi @melonpun I can think of a couple of ways.

You could either:

1.- use the anonymous authentication to save the data on Firestore with a unique ID for that user. That way you get the benefits of offline/online support and structured data as a database without the hustle of adding your own sql to the app on the phone. On top of that if at any time you want to add auth, in the future to offer more functionality or privacy, you simple convert that anonymous user to the auth one and done.

2.- If you don’t want anything to do with auth in Firebase you could also create a custom UID for the user and save it on the device with: (https://pub.dev/packages/shared_preferences) that allows you to save small amounts of data on the device. Then save, with that UID, on Firestore the data. The only thing with this is that you need to keep your Firestore rules completely open, which for security reasons it is not the best. But if you don’t store any sensitive data and you don’t really care about the possibility of someone hacking and erasing the database, then it is a solution.

3.- Last would be to use: (https://pub.dev/packages/sqflite) and create you own database on device to store that data.

With all this solutions the thing you need to take into account is that if the user erases the cached/stored data of the app, or uninstalls and reinstall the app (like if he changes the phone) all the data will be lost.

If you have any doubts or I can help in any way let me know :wink:

2 Likes