我正在尝试在 ObjectBox 框中存储地图列表,但由于我是 ObjectBox 的新手,我不明白如何存储自定义数据类型。
我试图存储的数据(结构看起来像这样)
name: 'name',
total: 100,
refNo: 00,
listOfProds: [{Map1},{Map2},{Map3},...]//<-Problem
我试过了
@Entity()
class ABC{
int id;
String name;
int total;
int refNo;
List<Map>? products;
ABC({
this.id=0,
required this.name,
required this.total,
required this.refNo,
//required this.products, <-This will throw an error since List is not supported
});
}
//Adding into DB
void addIntoDB(){
late ABC _abc;
_abc = ABC(
name: 'name',
total: 100,
refNo: 00,
//How can I assign the 'list of maps here' or any other ways?
);
_store.box<ABC>().put(_abc);
}