MultipleRadioGroupException constructor
MultipleRadioGroupException({
- RadioGroupController? radioGroupController,
- GlobalKey<
RadioGroupState> ? key,
Throws an exception for a RadioGroupController that is applied to multiple RadioGroups.
radioGroupController
is the controller that is throwing the error.
key
is the key to the second RadioGroup that radioGroupController
was being applied to.
Implementation
MultipleRadioGroupException({
RadioGroupController? radioGroupController,
GlobalKey<RadioGroupState>? key,
}) {
/// This piece of the error message is set when `radioGroupController` is
/// provided.
String? errMsgRGC;
// Check to see if the radio group controller that caused `this` exception
// to be thrown was provided.
if (radioGroupController != null) {
if (key == null) {
errMsgRGC = "RadioGroupController:"
"${radioGroupController.myRadioGroupKey.toString()} is being "
"applied to another `RadioGroup`!";
} else {
errMsgRGC = "This controller was already applied to RadioGroup:"
"${radioGroupController.myRadioGroupKey.toString()} and it now "
"being applied to RadioGroup:${key.toString()}!";
}
throw ("$_errMsgPt1 $errMsgRGC $_errMsgPt2\n\n$_hint");
} else {
throw (_cause);
}
}