'Change Selected items in multi select dynamically

I use a multi-select https://pub.dev/packages/multi_select_flutter/example in a page like below (Properties+) enter image description here

the multi-select has initialValue property which I could pass pre-selected items in them and it work in firt time of the loading of the page . I want to when I push on edit button in the page the multi-select will cosider new seleced items as pre-selected values and the selected items will change according to the new data.

   MultiSelectDialogField(
                    items: _items,
                    initialValue: _selectedPorperties,
                    title: Text("Properties"),
                    selectedColor: Colors.blue,
                    decoration: BoxDecoration(
                      color: Colors.blue.withOpacity(0.1),
                      borderRadius: BorderRadius.all(Radius.circular(40)),
                      border: Border.all(
                        color: Colors.blue,
                        width: 2,
                      ),
                    ),
                    buttonIcon: Icon(
                      Icons.add,
                      color: Colors.blue,
                    ),
                    buttonText: Text(
                      "Properties",
                      style: TextStyle(
                        color: Colors.blue[800],
                        fontSize: 16,
                      ),
                    ),
                    onConfirm: (results) {
                      _selectedPorperties = results;
                    },

                  )

_selectedPorperties is a dynamic list which I fill them after pushing on Edit button. in the body of Widget build(BuildContext context)

List<dynamic> _selectedPorperties = [];


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source