What is the best method to save Objects local data in Firemonkey mobile app?


In my app I got JSON response from RESTServer. Then I convert them into Data Objects, store them in TObjectList and then bind the list to TListBindSourceAdapter for display.

I would like to save the TObjectList data to local storage. My question is: what is the best method to save it?

I tried to create a SQLite DB, I could save records into SQLite DB but it required to convert my TObjectList into DB records manually in code, and when I retrieve I need to convert it back to data object. It involves more development effort.

Or should I use SaveState? I could save local data as string using SaveState. I could try to use TJson.ObjectToJson to convert Data Object into JSON and save it. To do this, I could save the TObjectList into Array, store it into a data object and do convert to JSON. when retrieve I could convert back using TJson.JsonToObject.

Or is there any better method to do so? Is there a common method to save local data in Firemonkey? Is there something similar to State Management in Angular?

Comments are closed.