// 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 { CountryResponse({ this.countries, this.success, this.status, }); List? countries; bool? success; int? status; factory CountryResponse.fromJson(Map json) => CountryResponse( countries: List.from(json["data"].map((x) => Country.fromJson(x))), success: json["success"], status: json["status"], ); Map toJson() => { "data": List.from(countries!.map((x) => x.toJson())), "success": success, "status": status, }; } class Country { Country({ this.id, this.code, this.name, this.status, }); @override toString() => '$name'; int? id; String? code; String? name; int? status; factory Country.fromJson(Map json) => Country( id: json["id"], code: json["code"], name: json["name"], status: json["status"], ); Map toJson() => { "id": id, "code": code, "name": name, "status": status, }; }