setSelected method
Implementation
void setSelected(String level0, String level1, String level2, bool status) {
// 省
CityModel item0 = records.firstWhere(
(element) => element.areaCode.toString() == level0,
orElse: () {
return CityModel.fromParams();
},
);
if (item0.getIsExsitLabel) {
item0.setSelected(status);
}
// 市
CityModel item1 = item0.children.firstWhere(
(element) => element.areaCode.toString() == level1,
orElse: () {
return CityModel.fromParams();
},
);
if (item1.getIsExsitLabel) {
item1.setSelected(status);
}
// 区
CityModel item2 = item1.children.firstWhere(
(element) => element.areaCode.toString() == level2,
orElse: () {
return CityModel.fromParams();
},
);
if (item2.getIsExsitLabel) {
item2.setSelected(status);
}
}