// To parse this JSON data, do // // final country = countryFromJson(jsonString); import 'package:meta/meta.dart'; import 'dart:convert'; Country countryFromJson(String str) => Country.fromJson(json.decode(str)); String countryToJson(Country data) => json.encode(data.toJson()); class Country { Country({ required this.id, required this.name, required this.code, }); final int? id; final String? name; final String? code; factory Country.fromJson(Map json) => Country( id: json["id"], name: json["name"], code: json["code"].toString(), ); Map toJson() => { "id": id, "name": name, "code": code, }; @override String toString() { return '$id $name $code '; } }