multiselect-dropdown icon indicating copy to clipboard operation
multiselect-dropdown copied to clipboard

controller not working properly

Open KaranChoudhary8 opened this issue 1 year ago • 1 comments

controller.setItems() controller.selectWhere() controller.selectIndex()

i aim is to fetch select items from database store earlier ...

so i am using this methods but these are not working

error i get during controller.setItem() is: The following assertion was thrown while dispatching notifications for MultiSelectController<MyModelClass>: Assertion failed: file:///C:/Softwares/Flutter/flutter/packages/flutter/lib/src/widgets/overlay.dart:1582:12 SchedulerBinding.instance.schedulerPhase != SchedulerPhase.persistentCallbacks is not true MultiSelectController<MyModelClass> sending notification was: MultiSelectController(options: [ValueItem(label: hero, value: Instance of 'MyModelClass', disabled: false, selected: true), ValueItem(label: employee, value: Instance of 'MyModelClass', disabled: false, selected: true)], open: false)

and in case of controller.selectWhere() and controller.selectIndex().... Nothing happens no error no nothing

KaranChoudhary8 avatar Sep 24 '24 17:09 KaranChoudhary8

I found the: you need to mark the respective item in the items attribute under the MultiDropdown as true. For example:

 MultiDropdown<T>(
          items: items!
              .map((item) => DropdownItem(
                  label: item.toString(),
                  value: item,
                  selected: selected!.contains(item.toList(),
        )

The following functions are not working because in items attribute under the MultiDropdown, the item.selected gets overridden:

controller.selectWhere()
controller.selectIndex()
controller.select()

Hmmza-tariq avatar Feb 02 '25 13:02 Hmmza-tariq