So @Latest_viral , so build block with same logic for firebase.
What if we have uninstalled app and then we be came back after some days?
adding to @nikzdreamer2001, and what if user clear data of app?
instead tinyDB use tinyDBweb, firebase or you may try asteroid DB by @yusufcihan
I aslo said that store it in your database too
If something like this happens then u can get backup
In my case whenever app loaded data it also checks for every post what its value is in database if its liked or not liked
if liked then it show the blue like icon ( if u r using a blue/ any other color icon for showing liked posts)
And if its not liked then it will show the simple icon and here u can also uodate your tinydb data
Updated
i suggested this to check locally in app
in your case on every click app will get data from database which is not a good idea
Instead check it locally in app
suppose if connection is week and app is unable to get data from firebase or other database it will cause delays in app actions and furthermore it may crash the app in some cases
First of all, create a child in Firebase as follows:
The likedposts tag will store the URL of every posts that user has liked.
You can understand the rest things from the block itself.
Hope it helped you.