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.5 KiB
Dart
66 lines
1.5 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"],
|
|
data: json["data"] == null ? null : List<CityData>.from(json["data"].map((x) => CityData.fromJson(x))),
|
|
messageStatus: json["messageStatus"],
|
|
message: json["message"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"totalItemsCount": totalItemsCount,
|
|
"data": data == null ? null : List<dynamic>.from(data!.map((x) => x.toJson())),
|
|
"messageStatus": messageStatus,
|
|
"message": 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"],
|
|
cityName: json["cityName"],
|
|
cityNameN: json["cityNameN"],
|
|
countryId: json["countryID"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"id": id,
|
|
"cityName": cityName,
|
|
"cityNameN": cityNameN,
|
|
"countryID": countryId,
|
|
};
|
|
}
|