selectSilentlyAt method
Sets the value of the selected item in this controller's radio group to
the value of the element at index in the radio group's value list.
This is done without calling the onChanged callback.
Note: By setting index to -1, the radio group will deselect all
options.
@throws IndexOutOfBoundsException If the index provided is not within
the range of the radio group's value list.
@throws ControllerDecoupledException If the controller cannot access the value of its radio group.
Implementation
void selectSilentlyAt(int index) {
if (_myRadioGroup != null) {
if (index == -1) {
_myRadioGroup!.setValueSilently(null);
} else if (index >= 0 && index < _myRadioGroup!.widget.values.length) {
_myRadioGroup!.setValueSilently(_myRadioGroup!.widget.values[index]);
} else {
throw IndexOutOfBoundsException(
index: index,
iterable: _myRadioGroup!.widget.values,
);
}
} else {
// If it makes it to this point, something has gone wrong.
throw ControllerDecoupledException(radioGroupController: this);
}
}