Province.fromJson constructor
Implementation
factory Province.fromJson(Map<String, dynamic> json) {
List<City> cityList = [];
if (json['children'] != null) {
cityList = List<City>.from(
json['children'].map((city) => City.fromJson(city)),
);
}
return Province(
name: json['name'] ?? '',
longitude: double.tryParse(json['log'] ?? '0.0') ?? 0.0,
latitude: double.tryParse(json['lat'] ?? '0.0') ?? 0.0,
cities: cityList,
);
}