hasConverterNullEncode function
bool?
hasConverterNullEncode(
- DartType targetType,
- TypeHelperContextWithConfig ctx, {
- bool forNullCheck = false,
If there is no converter for the params, return null.
Otherwise, returns true if the converter has a null return value.
Used to make sure we create a smart encoding function.
Implementation
bool? hasConverterNullEncode(
DartType targetType,
TypeHelperContextWithConfig ctx, {
bool forNullCheck = false,
}) {
final data = _typeConverter(targetType, ctx);
if (data == null) {
return null;
}
return data.jsonType.isNullableType ||
(forNullCheck &&
!data.fieldType.isNullableType &&
targetType.isNullableType);
}