onChanged property
- @Deprecated('Use RadioGroup to handle value change instead. ' 'This feature was deprecated after v3.32.0-0.0.pre.')
final
Called when the user selects this radio button.
The radio button passes value as a parameter to this callback. The radio button does not actually change state until the parent widget rebuilds the radio button with the new groupValue.
If null, the radio button will be displayed as disabled.
The provided callback will not be invoked if this radio button is already selected and toggleable is not set to true.
If the toggleable is set to true, tapping a already selected radio will
invoke this callback with null
as value.
The callback provided to onChanged should update the state of the parent StatefulWidget using the State.setState method, so that the parent gets rebuilt.
For example:
Radio<SingingCharacter>(
value: SingingCharacter.lafayette,
groupValue: _character,
onChanged: (SingingCharacter? newValue) {
setState(() {
_character = newValue;
});
},
)
This is deprecated, use RadioGroup to handle value change instead.
Implementation
@Deprecated(
'Use RadioGroup to handle value change instead. '
'This feature was deprecated after v3.32.0-0.0.pre.',
)
final ValueChanged<T?>? onChanged;