Hi everyone I want to store data coming from APIs...
# multiplatform
m
Hi everyone I want to store data coming from APIs so that I can show the previous data to the users until new data come from the API, like we use redux in the web apps. can anyone tell me how to implement that behaviour? Thank you in advance.
r
you will need a local DB to store the data you get from the API. what you can do: 1. your Api call should only interact with the local database, whenever you call the api you replace all the database data with the new data 2. And your Ui collects data from the local database all the time as a Flow, so whenever a new results is stored in the DB it will be reflected on your Ui to use the local DB you can use RoomDB, or SqlDelight… or whatever you like, but not sure if RoomDB supports KMP
1
m
Thank you @Raed Ghazal