In a List of flutter multiselect, on selecting an item in one multiselect, all other multiselects with same item should get selected


I have multiple multi-select dropdowns with repeated options through the dropdowns.
Example Dropdown1 – Options [A,B,C,D]
Dropdown2 – Options [D,E,F,G]
So I want when I select Options A,D in the first dropdown, the option D of the second dropdown also gets selected at the same time.

The problem is FlutterMultiChipSelect (package: flutter_multi_chip_select) widget does not provide any event like on_selection/on_change where I can write the code to change selection for other multiselect dropdowns. It is managing the selection change internally.

final menuItems = ["A","B","C","D"];
var selectedItems = [];

            key: key,
            elements: List.generate(
                  (index) => MultiSelectItem<String>.simple(
                  title: menuItems[index].toString(),
                  value: menuItems[index].toString()),
            label: "Dropdown Select",
            values: selectedItems,

I tried the Providers to achieve it but Providers does not work until I call the setters/getters of the Object on which Provider is registered. But FlutterMultiChipSelect needs the reference to a list. So I cannot call the setters explicitly.


I solved it by using Provider construct in flutter for simple state management.
3 months back when I was newbie it really felt challanging to achieve this using set_state(){}. Which still feels challenging but thanks to Provider, it feels very straightforward now.

Answered By – Hack Daniels

Answer Checked By – Cary Denson (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.