2023-02-15 03:40:12 +00:00
|
|
|
// To parse this JSON data, do
|
|
|
|
//
|
|
|
|
// final city = cityFromJson(jsonString);
|
|
|
|
|
|
|
|
import 'package:meta/meta.dart';
|
|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
City cityFromJson(String str) => City.fromJson(json.decode(str));
|
|
|
|
|
|
|
|
String cityToJson(City data) => json.encode(data.toJson());
|
|
|
|
|
|
|
|
class City {
|
|
|
|
City({
|
|
|
|
required this.code,
|
|
|
|
required this.description,
|
|
|
|
required this.province,
|
|
|
|
required this.psgcCode,
|
|
|
|
required this.zipcode,
|
|
|
|
});
|
|
|
|
|
2023-02-15 08:48:34 +00:00
|
|
|
final String? code;
|
|
|
|
final String? description;
|
|
|
|
final Province? province;
|
|
|
|
final String? psgcCode;
|
|
|
|
final String? zipcode;
|
2023-02-15 03:40:12 +00:00
|
|
|
|
|
|
|
factory City.fromJson(Map<String, dynamic> json) => City(
|
|
|
|
code: json["code"],
|
|
|
|
description: json["description"],
|
2023-02-15 08:48:34 +00:00
|
|
|
province: json['province'] == null? null : Province.fromJson(json["province"]),
|
2023-02-15 03:40:12 +00:00
|
|
|
psgcCode: json["psgc_code"],
|
|
|
|
zipcode: json["zipcode"],
|
|
|
|
);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
"code": code,
|
|
|
|
"description": description,
|
2023-02-15 08:48:34 +00:00
|
|
|
"province": province!.toJson(),
|
2023-02-15 03:40:12 +00:00
|
|
|
"psgc_code": psgcCode,
|
|
|
|
"zipcode": zipcode,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
class Province {
|
|
|
|
Province({
|
|
|
|
required this.code,
|
|
|
|
required this.description,
|
|
|
|
required this.region,
|
|
|
|
required this.psgcCode,
|
|
|
|
required this.shortname,
|
|
|
|
});
|
|
|
|
|
2023-02-15 08:48:34 +00:00
|
|
|
final String? code;
|
|
|
|
final String? description;
|
|
|
|
final Region? region;
|
|
|
|
final String? psgcCode;
|
|
|
|
final String? shortname;
|
2023-02-15 03:40:12 +00:00
|
|
|
|
|
|
|
factory Province.fromJson(Map<String, dynamic> json) => Province(
|
|
|
|
code: json["code"],
|
|
|
|
description: json["description"],
|
2023-02-15 08:48:34 +00:00
|
|
|
region: json['region'] == null ? null : Region.fromJson(json["region"]),
|
2023-02-15 03:40:12 +00:00
|
|
|
psgcCode: json["psgc_code"],
|
|
|
|
shortname: json["shortname"],
|
|
|
|
);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
"code": code,
|
|
|
|
"description": description,
|
2023-02-15 08:48:34 +00:00
|
|
|
"region": region!.toJson(),
|
2023-02-15 03:40:12 +00:00
|
|
|
"psgc_code": psgcCode,
|
|
|
|
"shortname": shortname,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
class Region {
|
|
|
|
Region({
|
|
|
|
required this.code,
|
|
|
|
required this.description,
|
|
|
|
required this.psgcCode,
|
|
|
|
});
|
|
|
|
|
2023-02-15 08:48:34 +00:00
|
|
|
final int? code;
|
|
|
|
final String? description;
|
|
|
|
final String? psgcCode;
|
2023-02-15 03:40:12 +00:00
|
|
|
|
|
|
|
factory Region.fromJson(Map<String, dynamic> json) => Region(
|
|
|
|
code: json["code"],
|
|
|
|
description: json["description"],
|
|
|
|
psgcCode: json["psgc_code"],
|
|
|
|
);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
"code": code,
|
|
|
|
"description": description,
|
|
|
|
"psgc_code": psgcCode,
|
|
|
|
};
|
|
|
|
}
|