valueToSQLPlain method

EncodingValue<String, Object?> valueToSQLPlain(
  1. Object? value,
  2. Type? type, {
  3. String? key,
})

Implementation

EncodingValue<String, Object?> valueToSQLPlain(Object? value, Type? type,
    {String? key}) {
  key ??= '?';

  if (value == null || value == Null) {
    return EncodingValueNull(key, type, encodeEncodingValueNull);
  } else if (value is num || value is bool) {
    return EncodingValuePrimitive(
        key, type, value, encodeEncodingValuePrimitive);
  } else if (value is Decimal) {
    return EncodingValuePrimitive(
        key, type, value.toDouble(), encodeEncodingValuePrimitive);
  } else if (value is DynamicInt) {
    return EncodingValuePrimitive(
        key, type, value.toBigInt(), encodeEncodingValuePrimitive);
  } else {
    return EncodingValueText(
        key, type, value.toString(), encodeEncodingValueText);
  }
}