0

I have been able to display JSON data from API in Future-builder. However, the widget has checkbox for each list. Whenever I check on one list, the whole list get checked. I want a help on how to check each list individually and be able to use the data of the selected list.

sinnoor c
  • 1
  • 3

1 Answers1

0

Add a reference for each checkbox you want to be displayed.

First, create an empty list of booleans on your Stateful widget.

List<bool> _checkBoxValues = [];

Then for every item from your Api, add it on your _checkBoxValues.

bool x = false;
_checkBoxValues.add(x);

Then you access it using

return Checkbox(
        value: _checkBoxValues[index],
      ),

            
Pol
  • 496
  • 3
  • 6