onChanged property

ValueChanged<bool?>? onChanged

Called when the value of the checkbox should change.

The checkbox passes the new value to the callback but does not actually change state until the parent widget rebuilds the checkbox tile with the new value.

If null, the checkbox will be displayed as disabled.

The callback provided to onChanged should update the state of the parent StatefulWidget using the State.setState method, so that the parent gets rebuilt; for example:
  value: _throwShotAway,
  onChanged: (bool? newValue) {
    setState(() {
      _throwShotAway = newValue;
  title: const Text('Throw away your shot'),


final ValueChanged<bool?>? onChanged;