onChanged property

ValueChanged<bool> onChanged
final

Called when the user clicks on this check button.

The checkbox button passes value as a parameter to this callback. The checkbox button does not actually change state until the parent widget rebuilds the checkbox button with the new value.

The callback provided to onChanged should update the state of the parent StatefulWidget using the State.setState method; for example:

OptimusCheckbox(
  isChecked: _checked,
  onChanged: (bool newValue) {
    setState(() {
      _checked = newValue;
    });
  },
)

Implementation

final ValueChanged<bool> onChanged;