getCities static method
dynamic
getCities(
- String province
)
Implementation
static getCities(String province) {
var emptyData = {'name': "全部", 'cityCode': ''};
if (province == '全部' && addAllItem) return [emptyData];
String code = '';
locations['86']!.forEach((key, value) {
if (value == province) {
code = key;
}
});
Map<String, String>? areaList = locations[code];
// print('longer >>>$code 城市数据:$areaList');
var data = [];
if (areaList != null && addAllItem) data.add(emptyData);
areaList?.forEach((key, value) {
data.add({'name': value, 'cityCode': key});
});
return data;
}