简体   繁体   中英

I am having problem running multi_select_flutter widget properly in flutter

hi I am trying multi_select_flutter but was unable to solve this error

A value of type 'List<Object?>' can't be assigned to a variable of type 'List'.

this is my code of multi_select_flutter widget i am using

MultiSelectBottomSheetField(
                  initialChildSize: 0.4,
                  listType: MultiSelectListType.CHIP,
                  searchable: true,
                  buttonText: Text("Favorite Animals"),
                  title: Text("Animals"),
                  items: _items,
                  onConfirm: (values) {
                    // _selectedAnimals2 = values;
                  },
                  chipDisplay: MultiSelectChipDisplay(
                    onTap: (value) {
                      setState(() {
                        _selectedAnimals2.remove(value);
                      });
                    },
                  ),
                ),

_items's element should be non-nullable, because items decalaration like: 在此处输入图像描述

type not matched is the reason you encounter the error.

在此处输入图像描述

Its already there but still it shows same error

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM