json_model
json_model copied to clipboard
type 'String' is not a subtype of type 'Map<String, dynamic>' in type cast问题处理
希望作者有时间能处理下
"relist":"$[]Zdata",
上面的代码生成下面的代码
..relist = (json['relist'] as List) ?.map((e) => e == null ? null : Zdata.fromJson(e as Map<String, dynamic>)) ?.toList()
报错: type 'String' is not a subtype of type 'Map<String, dynamic>' in type cast
把生成的代码改成:
..relist = (json['relist'] as List) ?.map((e) => e == null ? null : Zdata.fromJson(jsonDecode(e) as Map<String, dynamic>)) ?.toList()
问题解决。
感谢提供好工具