decode static method

Object? decode(
  1. Object? value
)

Decodes value when it is a JSON string, otherwise returns value.

Implementation

static Object? decode(Object? value) {
  if (value == null) {
    return null;
  }
  if (value is String) {
    try {
      return jsonDecode(value);
    } on FormatException {
      return value;
    }
  }
  return value;
}