2023-09-01 03:22:48 +00:00
|
|
|
// To parse this JSON data, do
|
|
|
|
//
|
|
|
|
// final city = cityFromJson(jsonString);
|
|
|
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
City cityFromJson(String str) => City.fromJson(json.decode(str));
|
|
|
|
|
|
|
|
String cityToJson(City data) => json.encode(data.toJson());
|
|
|
|
|
|
|
|
class City {
|
2023-11-10 08:38:47 +00:00
|
|
|
final int? id;
|
2023-09-01 03:22:48 +00:00
|
|
|
final String? cityCode;
|
|
|
|
final String? cityDescription;
|
|
|
|
|
|
|
|
City({
|
2023-11-10 08:38:47 +00:00
|
|
|
this.id,
|
2023-09-01 03:22:48 +00:00
|
|
|
this.cityCode,
|
|
|
|
this.cityDescription,
|
|
|
|
});
|
|
|
|
|
2023-11-10 08:38:47 +00:00
|
|
|
City copy({int? id, String? cityCode, String? cityDescription}) {
|
|
|
|
return City(
|
|
|
|
id: id ?? this.id,
|
|
|
|
cityCode: cityCode ?? this.cityCode,
|
|
|
|
cityDescription: cityDescription ?? this.cityDescription);
|
|
|
|
}
|
|
|
|
|
2023-09-01 03:22:48 +00:00
|
|
|
factory City.fromJson(Map<String, dynamic> json) => City(
|
2023-11-10 08:38:47 +00:00
|
|
|
id: json["id"],
|
2023-09-01 03:22:48 +00:00
|
|
|
cityCode: json["city_code"],
|
|
|
|
cityDescription: json["city_description"],
|
|
|
|
);
|
|
|
|
|
2023-11-10 08:38:47 +00:00
|
|
|
factory City.fromJson2(Map<String, dynamic> json) => City(
|
|
|
|
id: json["id"],
|
|
|
|
cityCode: json["cityCode"],
|
|
|
|
cityDescription: json["cityDescription"],
|
|
|
|
);
|
|
|
|
|
2023-09-01 03:22:48 +00:00
|
|
|
Map<String, dynamic> toJson() => {
|
2023-11-10 08:38:47 +00:00
|
|
|
"id": id,
|
2023-09-01 03:22:48 +00:00
|
|
|
"city_code": cityCode,
|
|
|
|
"city_description": cityDescription,
|
|
|
|
};
|
|
|
|
}
|