// 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 { final int? id; final String? cityCode; final String? cityDescription; City({ this.id, this.cityCode, this.cityDescription, }); City copy({int? id, String? cityCode, String? cityDescription}) { return City( id: id ?? this.id, cityCode: cityCode ?? this.cityCode, cityDescription: cityDescription ?? this.cityDescription); } factory City.fromJson(Map json) => City( id: json["id"], cityCode: json["city_code"], cityDescription: json["city_description"], ); factory City.fromJson2(Map json) => City( id: json["id"], cityCode: json["cityCode"], cityDescription: json["cityDescription"], ); Map toJson() => { "id": id, "city_code": cityCode, "city_description": cityDescription, }; }