Before I updated my dart version to support only non-null that code was working fine:
Radio(
value: ExcerciseType.weight,
groupValue: type,
onChanged: (ExcerciseType value) {
appState.exerciseType = value;
},
),
Now the compiler complaints:
"The argument type 'void Function(ExcerciseType)' can't be assigned to the parameter type 'void Function(ExcerciseType?)?'.",
This would fix it:
onChanged: (ExcerciseType? value) {
appState.exerciseType = value as ExcerciseType;
},
but that fix is not logical at all. With the as cast I just say value might be null at runtime and appState.exerciseType can accept null values but that is not true at all! appState.ExerciseType is of type ExcerciseType and not ExcerciseType?.
What do I not understand here?