// To parse this JSON data, do // // final welcome = welcomeFromJson(jsonString); import 'dart:convert'; Locations welcomeFromJson(String str) => Locations.fromJson(json.decode(str)); String welcomeToJson(Locations data) => json.encode(data.toJson()); class Locations { Location location; Locations({ required this.location, }); factory Locations.fromJson(Map json) => Locations( location: Location.fromJson(json["location"]), ); Map toJson() => { "location": location.toJson(), }; } class Location { List country; List state; List city; Location({ required this.country, required this.state, required this.city, }); factory Location.fromJson(Map json) => Location( country: List.from(json["country"].map((x) => Country.fromJson(x))), state: List.from(json["state"].map((x) => States.fromJson(x))), city: List.from(json["city"].map((x) => City.fromJson(x))), ); Map toJson() => { "country": List.from(country.map((x) => x.toJson())), "state": List.from(state.map((x) => x.toJson())), "city": List.from(city.map((x) => x.toJson())), }; } class City { String cityName; String distId; String stateId; String countryId; City({ required this.cityName, required this.distId, required this.stateId, required this.countryId, }); factory City.fromJson(Map json) => City( cityName: json["cityName"], distId: json["distId"], stateId: json["stateId"], countryId: json["countryId"], ); Map toJson() => { "cityName": cityName, "distId": distId, "stateId": stateId, "countryId": countryId, }; } class Country { String countryName; String countryId; Country({ required this.countryName, required this.countryId, }); factory Country.fromJson(Map json) => Country( countryName: json["countryName"], countryId: json["countryId"], ); Map toJson() => { "countryName": countryName, "countryId": countryId, }; } class States { String stateName; String stateId; String countryId; States({ required this.stateName, required this.stateId, required this.countryId, }); factory States.fromJson(Map json) => States( stateName: json["stateName"], stateId: json["stateId"], countryId: json["countryId"], ); Map toJson() => { "stateName": stateName, "stateId": stateId, "countryId": countryId, }; }