我有一个那样的JSON
[
{
"id": "2a5",
"employeeNumber": "101",
"firstName": "Sachin",
"lastName": "Agrawal"
},
{
"id": "1f7",
"employeeNumber": "151",
"firstName": "Karsten",
"lastName": "Andersen"
},
]
我试着这样解析JSON
List<Employee> employees = (jsonDecode(response.data) as List)
.map((data) => Employee.fromJson(data))
.toList();
它会导致以下错误
List<dynamic>' is not a subtype of type 'String'
when I try to decode the JSON 它会导致以下错误
Unhandled Exception: type 'List<dynamic>' is not a subtype of type 'String'
解析这种类型的JSON的正确方法是什么?