isJson method
Whether the string is valid JSON (object or array).
Implementation
bool isJson() {
try {
final v = jsonDecode(this);
return v is Map || v is List;
} catch (_) {
return false;
}
}
Whether the string is valid JSON (object or array).
bool isJson() {
try {
final v = jsonDecode(this);
return v is Map || v is List;
} catch (_) {
return false;
}
}