fromJson static method

JsonValue? fromJson(
  1. Map<String, dynamic>? json
)

Implementation

static JsonValue? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  switch (json['@type']) {
    case JsonValueArray.constructor:
      return JsonValueArray.fromJson(json);

    case JsonValueBoolean.constructor:
      return JsonValueBoolean.fromJson(json);

    case JsonValueNull.constructor:
      return JsonValueNull.fromJson(json);

    case JsonValueNumber.constructor:
      return JsonValueNumber.fromJson(json);

    case JsonValueObject.constructor:
      return JsonValueObject.fromJson(json);

    case JsonValueString.constructor:
      return JsonValueString.fromJson(json);

    default:
      return null;
  }
}