【发布时间】:2019-10-23 12:02:17
【问题描述】:
我想解析这个json
'supperset':[
[1,2,3],
[4,5,6],
[1,8,9]
]
我在从服务器获取数据进行解析时使用此代码
class Session {
final List<List<int>> supersets;
Session._({ this.supersets});
factory Session.fromJson(Map jsonMap) {
return new Session._(
supersets : (jsonMap['superSets'].cast<List<int>>()),
);
}
}
但是当用户从这个代码得到这个错误时
type 'List<dynamic>' is not a subtype of type 'List<int>' in type cast
如何解析它是正确的,但是会出现这个错误
【问题讨论】: