Home > Blockchain >  Unsupported Error was thrown while handling a gesture. Unsupported operation: indexed set || flutter
Unsupported Error was thrown while handling a gesture. Unsupported operation: indexed set || flutter

Time:10-01

I am working on a list of chip widget where the parent widget is ListView builder. When I click on any of the chip I got this error The following UnsupportedError was thrown while handling a gesture: Unsupported operation: indexed set When the exception was thrown, this was the stack:

I am working on flutter web

here is my code:-

                            ChipList(
                              style: TextStyle(color: primaryBlue),
                              shouldWrap: true,
                              listOfChipNames: _dogNames,
                              // extraOnToggle: (index) {
                              //   print(index);
                              // },                                  
                              borderRadiiList: const [5],
                              activeBgColorList: const [Colors.white],
                              inactiveBgColorList: const [Colors.white],
                              activeTextColorList: const [Colors.white],
                              
                              listOfChipIndicesCurrentlySeclected: const [
                                100
                              ],
                              inactiveBorderColorList: [primaryBlue],
                              activeBorderColorList: [primaryBlue],
                            ),
                         

This is my error

CodePudding user response:

I'm not really familiar with ChipList but looking at the documentation of it it says an important warning message

⚠ Warning ! The flutter_lints package might suggest that you make listOfChipIndicesCurrentlySeclected a constant.

PLEASE DO NOT DO SO. The widget will not respond to user interaction, seemingly without any reason.

That list will be updated as the user interacts with the widget. It is intended to be used in case you would like to incorporate the contents for any logic.

I don't know if it's related to your issue, but I recommend removing the const keyword that you have at your listOfChipIndicesCurrentlySeclected

  • Related