validateFieldAssignment method
Validate that a value can be assigned to a field with a specific generic type constraint
Implementation
void validateFieldAssignment(
String fieldName, Object? value, RuntimeType? expectedType) {
if (expectedType == null) {
return; // No type constraint
}
if (!_isValueCompatibleWithType(value, expectedType)) {
throw RuntimeD4rtException(
"Type error: Cannot assign value of type '${_getValueTypeName(value)}' to field '$fieldName' expecting type '${expectedType.name}' in class '${klass.name}'");
}
}