didChange method

void didChange (
  1. T newValue
)

Updates this field's state to the new value. Useful for responding to child widget changes, e.g. Slider's Slider.onChanged argument.

Triggers the InputForm.onChanged callback. Also revalidates all fields of the form if InputForm.autovalidate is true.

Implementation

void didChange(T newValue) {
  if (value == newValue) {
    return;
  }
  setState(() {
    value = newValue;
  });
  if (_hasAutosave()) {
    save();
  } else if (_hasAutovalidate()) {
    _validate();
  }
  _formState?._fieldDidChange();
  if (widget.onChanged != null) {
    widget.onChanged(value);
  }
}