// To parse this JSON data, do // // final countryResponse = countryResponseFromJson(jsonString); import 'dart:convert'; CountryResponse countryResponseFromJson(String str) => CountryResponse.fromJson(json.decode(str)); String countryResponseToJson(CountryResponse data) => json.encode(data.toJson()); class CountryResponse { List data; CountryResponse({ required this.data, }); factory CountryResponse.fromJson(Map json) => CountryResponse( data: List.from(json["data"].map((x) => CountryInfo.fromJson(x))), ); Map toJson() => { "data": List.from(data.map((x) => x.toJson())), }; } class CountryInfo { int id; String code; String name; bool isActive; CountryInfo({ required this.id, required this.code, required this.name, required this.isActive, }); factory CountryInfo.fromJson(Map json) => CountryInfo( id: json["id"], code: json["code"], name: json["name"], isActive: json["is_active"], ); Map toJson() => { "id": id, "code": code, "name": name, "is_active": isActive, }; }