InvalidKeyTypeException constructor

InvalidKeyTypeException({
  1. Key? key,
})

Throws an exception for a RadioGroup is given a key that is not of the type GlobalKey<RadioGroupState>

key is the mistyped key that was used.

Implementation

InvalidKeyTypeException({Key? key}) {
  if (key == null) {
    // If no key was provided, throw the default error message.
    throw (_cause);
  } else {
    // If the key was provided, include it in the error message to help with
    // debugging.
    throw ("$_errMsgPt1 "
        "${key.runtimeType}:${key.toString()} is not a valid key for a "
        "`RadioGroup` $_errMsgPt2");
  }
}