问题
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.
回答1:
You can serialize it to json
and save the string. Then when you read it you can parse it back to an Object
来源:https://stackoverflow.com/questions/60267429/storing-list-of-objects-in-flutter