onChanged property Null safety

ValueChanged? onChanged
final

Called when the user is selecting a new value for the slider by dragging.

The slider passes the new value to the callback but does not change its state until the parent widget rebuilds the slider with new value.

If it is null, the slider will be disabled.

This snippet shows how to create a numeric SfSlider.

double _value = 4.0;

SfSlider(
  min: 0.0,
  max: 10.0,
  value: _value,
  onChanged: (dynamic newValue) {
    setState(() {
      _value = newValue;
    });
  },
)

Implementation

final ValueChanged<dynamic>? onChanged;