defaultPropertyBuilderJsonConverter function Null safety

String defaultPropertyBuilderJsonConverter(
  1. PropertyBuilder property,
  2. String value
)

Implementation

String defaultPropertyBuilderJsonConverter(
  PropertyBuilder property,
  String value,
) {
  if (property.type == 'String') {
    return '$value as String';
  } else if (property.type == 'bool') {
    return '$value as bool';
  } else if (property.type == 'int') {
    return '($value as num).toInt()';
  } else if (property.type == 'double') {
    return '($value as num).toDouble()';
  } else if (property.type == 'DateTime') {
    return 'DateTime.parse($value as String)';
  } else {
    return '$value';
  }
}