I have array of country json objects like this
[{"id":4,"name":"Afghanistan","alpha2":"af","alpha3":"afg"},
{"id":8,"name":"Albania","alpha2":"al","alpha3":"alb"},
{"id":12,"name":"Algeria","alpha2":"dz","alpha3":"dza"},..
I have got them to a map like this
Map<String, dynamic> jsonMap;
jsonMap = json.decode(jsonString);
After this I have the data like this
[{id: 4, name: Afghanistan, alpha2: af, alpha3: afg}, {id: 8, name: Albania, alpha2: al, alpha3: alb}, ...
What i want to do is create a List of county objects from this
Country
{
int id;
String name;
String alpha2;
String alpha3;
}
Can anyone explain how to do this conversion ?