initState method
Called when the app creates a radio group. This needs to be called specifically to set default values in the RadioGroupController for this radio group.
Implementation
@override
void initState() {
super.initState();
if (widget.key != null) {
if (widget.key is! GlobalKey<RadioGroupState>) {
throw InvalidKeyTypeException();
}
// Let the controller know who its radio group is.
widget._controller.myRadioGroupKey =
widget.key as GlobalKey<RadioGroupState<T>>;
}
// Set default starting value.
if (widget.indexOfDefault < 0) {
_value = null;
} else {
_value = widget.values[widget.indexOfDefault];
}
}