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.
Asked
Active
Viewed 380 times
0
-
Can post your code with sample json data – Sagar Acharya Nov 29 '21 at 05:59
-
Please provide enough code so others can better understand or reproduce the problem. – Community Dec 03 '21 at 18:32
1 Answers
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