passo_mobile_app/lib/model/location/country.dart

41 lines
826 B
Dart
Raw Normal View History

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,
});
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"],
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
}