selectedItemById static method
selected item by id from dropdown
Implementation
static DropdownItem? selectedItemById(List<DropdownItem> list, String id) {
DropdownItem? selectedItem;
for (DropdownItem obj in list) {
if (DropdownItem._equals(id, obj.id)) {
selectedItem = obj;
break;
}
}
if (selectedItem == null && list.isNotEmpty) {
selectedItem = list[0];
}
return selectedItem;
}