【发布时间】:2021-10-28 21:13:35
【问题描述】:
我是 Flutter 的新手,遇到以下类的 json 序列化问题:
class Profile {
DatabaseReference _id;
String userId; // related to Google UserId
Map<String,Set> attrs; // String is the key and the Set includes all possible value
}
Profile 类中的 Map 有一个 String 作为 key,一个 Set 作为它的 value,它会像:
attrs = [{"food":["beef","fish","pork"]},{"work_experience":["company1","company2"],...}]
有没有好的解决方案来序列化/反序列化类 toJson/fromJson?
【问题讨论】:
标签: json flutter serialization deserialization