toggleTristate method

void toggleTristate()

Cycles through all three states in order: checked -> unchecked -> indeterminate.

Provides complete tri-state cycling behavior. Use this instead of toggle when working with tri-state checkboxes that need to support indeterminate state.

Implementation

void toggleTristate() {
  value = value == CheckboxState.checked
      ? CheckboxState.unchecked
      : value == CheckboxState.unchecked
          ? CheckboxState.indeterminate
          : CheckboxState.checked;
}