You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
如果要解析列表就要添加类似这样的一个方法
static List fromJsonList(String jsonStr) {
List listJson = json.decode(jsonStr);
List list = List();
for (var item in listJson) {
list.add(AddressInfoModel.fromJson(item));
}
return list;
}
[{"a":"xx","b":"bbb"},{"a":"xx","b":"bbbb"},{"a":"xx","b":"bbbbb"}]
dui对于这种整个json就是一个数组的,设置的没问题,解析报错
type 'String' is not a subtype of type 'int' of 'index'
我看了下,生成的代码jsonRes['json_list'],这里明显有问题,json_list这个key是不存在的,所以报错了
个人感觉对于这种类型,直接当做数组item的json来处理,额外再提供一下数组解析的方法就好了
The text was updated successfully, but these errors were encountered: