onChanged method

  1. @protected
void onChanged(
  1. T? newValue
)

This method is called by subclasses when the value changes. Here, the new value is only set and SettingsWidgetBase.onChanged is only called when the value actually changes

Implementation

@protected
void onChanged(T? newValue) {
  setState(() {
    T? oldValue = value;
    this.value = newValue;
    if (widget.onChanged != null) {
      widget.onChanged!(oldValue, newValue);
    }
    persist();
  });
}