class ProvinceModel { int? id; String? name; List? cityList; ProvinceModel({this.id, this.name, this.cityList}); ProvinceModel.fromJson(Map json) { id = json['id']; name = json['name']; if (json['cityList'] != null) { cityList = (json['cityList'] as List).map((e) => City.fromJson(e)).toList(); }else cityList = []; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['name'] = this.name; if (this.cityList != null) { data['cityList'] = this.cityList!.map((v) => v.toJson()).toList(); } return data; } } class City { int? id; String? name; List? districts; City({this.id, this.name, this.districts}); City.fromJson(Map json) { id = json['id']; name = json['name']; if (json['districts'] != null) { districts = (json['districts'] as List).map((e) => District.fromJson(e)).toList(); }else districts = []; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['name'] = this.name; if (this.districts != null) { data['cityList'] = this.districts!.map((v) => v.toJson()).toList(); } return data; } } class District { int? id; String? name; District({this.id, this.name}); District.fromJson(Map json) { id = json['id']; name = json['name']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['name'] = this.name; return data; } }