how to give checkbox in flutter code example
Example 1: checkbox in flutter
CheckboxListTile(
title: Text("title text"),
value: checkedValue,
onChanged: (newValue) {
setState(() {
checkedValue = newValue;
});
},
controlAffinity: ListTileControlAffinity.leading, // <-- leading Checkbox
)
Example 2: flutter checkbox
bool _value = true;
Checkbox(
value: _value,
onChanged: (bool newValue) {
setState(() {
_value = newValue;
});
},
)