DropdownSearch<StudentHappyPawn>.multiSelection(
compareFn: (i1, i2) => i1.reference.id == i2.reference.id,
popupProps: const PopupPropsMultiSelection.dialog(
showSearchBox: true,
showSelectedItems: true,
),
asyncItems: (String filter) => storage.getStudents(),
itemAsString: (StudentHappyPawn student) =>
student.studentAsString(),
selectedItems: pickedStudentList,
onChanged: (list) {
print("onChanged : $list");
pickedStudentList = list;
},
),
In the above code, I'm using the following library: https://pub.dev/packages/dropdown_search
It's great, but it seems that having together selectedItems along with onChanged does not work: it does show selected items at first, but upon adding more elements, the onChanged just keeps the default element (does not print the newly-checked-items).
If I remove the selectedItems attribute, it's now correctly updating and adding (printing) the newly checked items in the onChanged.
But I need selectedItems to work along with onChanged, any suggestions?