You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.9 KiB
Dart
66 lines
1.9 KiB
Dart
// To parse this JSON data, do
|
|
//
|
|
// final cities = citiesFromJson(jsonString);
|
|
|
|
import 'dart:convert';
|
|
|
|
Cities citiesFromJson(String str) => Cities.fromJson(json.decode(str));
|
|
|
|
String citiesToJson(Cities data) => json.encode(data.toJson());
|
|
|
|
class Cities {
|
|
Cities({
|
|
this.totalItemsCount,
|
|
this.data,
|
|
this.messageStatus,
|
|
this.message,
|
|
});
|
|
|
|
int? totalItemsCount;
|
|
List<CityData>? data;
|
|
int? messageStatus;
|
|
String? message;
|
|
|
|
factory Cities.fromJson(Map<String, dynamic> json) => Cities(
|
|
totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
|
|
data: json["data"] == null ? null : List<CityData>.from(json["data"].map((x) => CityData.fromJson(x))),
|
|
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
|
|
message: json["message"] == null ? null : json["message"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
|
|
"data": data == null ? null : List<dynamic>.from(data!.map((x) => x.toJson())),
|
|
"messageStatus": messageStatus == null ? null : messageStatus,
|
|
"message": message == null ? null : message,
|
|
};
|
|
}
|
|
|
|
class CityData {
|
|
CityData({
|
|
this.id,
|
|
this.cityName,
|
|
this.cityNameN,
|
|
this.countryId,
|
|
});
|
|
|
|
int? id;
|
|
String? cityName;
|
|
String? cityNameN;
|
|
int? countryId;
|
|
|
|
factory CityData.fromJson(Map<String, dynamic> json) => CityData(
|
|
id: json["id"] == null ? null : json["id"],
|
|
cityName: json["cityName"] == null ? null : json["cityName"],
|
|
cityNameN: json["cityNameN"] == null ? null : json["cityNameN"],
|
|
countryId: json["countryID"] == null ? null : json["countryID"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"id": id == null ? null : id,
|
|
"cityName": cityName == null ? null : cityName,
|
|
"cityNameN": cityNameN == null ? null : cityNameN,
|
|
"countryID": countryId == null ? null : countryId,
|
|
};
|
|
}
|