tryJsonDecode static method

dynamic tryJsonDecode(
  1. String? value
)

Returns value when it can be JSON-decoded, otherwise null.

Implementation

static dynamic tryJsonDecode(String? value) {
  if (value == null) return null;
  try {
    return jsonDecode(value);
  } catch (_) {
    return null;
  }
}