toggleChecked method

  1. @visibleForTesting
void toggleChecked()

Toggles checkbox via user action.

When it is indeterminate, toggle can go to checked or unchecked, depending on state indeterminateToChecked.

Implementation

@visibleForTesting
void toggleChecked() {
  if (disabled) return;
  if (readOnly == null || readOnly!) return;
  if (!indeterminate && !checked) {
    _setStates(checked: true);
  } else if (checked) {
    _setStates();
  } else {
    assert(indeterminate);
    _setStates(checked: indeterminateToChecked);
  }
}