tryToJson function
Implementation
Uint8List? tryToJson(CType type, dynamic value) {
if ((type is RecordClass ||
type is VariantClass ||
(type is TextClass && value is! String)) &&
// obj may be a map, must be ignore.
value is! Map) {
try {
return type.encodeValue(value.toJson());
} catch (e) {
return null;
}
}
return null;
}