2023-02-15 03:40:12 +00:00
|
|
|
// 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,
|
|
|
|
});
|
|
|
|
|
2023-02-15 08:48:34 +00:00
|
|
|
final int? id;
|
|
|
|
final String? name;
|
|
|
|
final String? code;
|
2023-02-15 03:40:12 +00:00
|
|
|
|
|
|
|
factory Country.fromJson(Map<String, dynamic> json) => Country(
|
|
|
|
id: json["id"],
|
|
|
|
name: json["name"],
|
2023-02-15 08:48:34 +00:00
|
|
|
code: json["code"].toString(),
|
2023-02-15 03:40:12 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
"id": id,
|
|
|
|
"name": name,
|
|
|
|
"code": code,
|
|
|
|
};
|
2023-02-27 06:26:27 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() {
|
|
|
|
return '$id $name $code ';
|
|
|
|
|
|
|
|
}
|
2023-02-15 03:40:12 +00:00
|
|
|
}
|