You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (value is num) {
...
var n = value.toString();
return "'$n'";
}
Also note doc comment is wrong.
//FIXME can probably simplify this, as in postgresql json type must take
// map or array at top level, not string or number. (I think???)
String encodeValueToJson(value, {getConnectionName()}) {
if (value == null)
return "'null'";
if (value is Map || value is List)
return encodeString(JSON.encode(value));
if (value is String)
return encodeString('"$value"');
if (value is num) {
// These are not valid JSON numbers, so encode them as strings.
// TODO consider throwing an error instead.
if (value.isNaN) return '"nan"';
if (value == double.INFINITY) return '"infinity"';
if (value == double.NEGATIVE_INFINITY) return '"-infinity"';
return value.toString();
}
try {
var map = value.toJson();
return encodeString(JSON.encode(value));
} catch (e) {
throw _error('Could not convert object to JSON. '
'No toJson() method was implemented on the object.', getConnectionName);
}
}
The text was updated successfully, but these errors were encountered:
Typeconverter.dart Line: 163
Change to:
Also note doc comment is wrong.
//FIXME can probably simplify this, as in postgresql json type must take
// map or array at top level, not string or number. (I think???)
String encodeValueToJson(value, {getConnectionName()}) {
if (value == null)
return "'null'";
}
The text was updated successfully, but these errors were encountered: