I am making an app, which contains two basic classes let's say Class1
and Class2
. And in Class1
I stored List<Class2>
as attribute with other attributes. My question is how to store List<Class2>
if I store some object of Class1
in sqflite database. Is there a way that I can store a List of Class2
objects in a single column of the database.
Asked
Active
Viewed 584 times
1

jastor_007
- 371
- 4
- 14
1 Answers
-1
You can serialize it to json
and save the string. Then when you read it you can parse it back to an Object

Sebastian
- 3,666
- 2
- 19
- 32
-
You are saying that I should store objects in a file? – jastor_007 Feb 17 '20 at 17:45
-
Nope, I'm saying you can store the list of objects parsed as `json` in a `TEXT` field of `SQFLITE` – Sebastian Feb 17 '20 at 18:15