isJsonEncodable function
Can jsonEncode represent this value at all? The expensive, authoritative
answer — only call it when approxJsonSize says the cheap walk was not
conclusive.
Implementation
bool isJsonEncodable(Object? value) {
try {
jsonEncode(value);
return true;
} catch (_) {
return false;
}
}