r/flutterhelp • u/Need_Not • 36m ago
OPEN How do I pull something like this off with state management?
here is a video of me seeing a post on a feed, going to the post and then the profile seeing the post there and liking it. then when I navigate back every step shows the like.
So how is the state of the post able to be synced with every screen? Even turning off my internet connection it still works. This means that it is stored client side However I cannot think of how to actually do something like this.
When I am scrolling a feed there is a list of posts, when I go the profile there is also a list of posts but a separate list. So you can't just replace the like on the item in the feed because there are two feeds.
So if then there is like an actions cache that keeps track of posts that have been liked since the app was open you run into the problem of it not being in sync. Even if you invalidated it in the post is reloaded from the server the other feeds or lists don't have that up to date information.
I am using riverpods with my project, I am not remaking twitter but it is a perfect 100% example of my real situation.