onValueChanged property Null safety

ValueChanged<double>? onValueChanged

Called during a drag when the user is selecting a new value for the pointer by dragging.

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

The callback provided to onValueChanged should update the state of the parent StatefulWidget using the State.setState method, so that the parent gets rebuilt; for example:

Widget build(BuildContext context) {
 return Container(
     child: SfRadialGauge(axes: <RadialAxis>[
     pointers: <GaugePointer>[
           value: _currentValue,
           onValueChanged: (double newValue) {
             setState(() {
               _currentValue = newValue;


final ValueChanged<double>? onValueChanged;