FixDescription.fromJson constructor

FixDescription.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json, {
  4. ClientUriConverter? clientUriConverter,
})

Implementation

factory FixDescription.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  json ??= {};
  if (json is Map) {
    String id;
    if (json.containsKey('id')) {
      id = jsonDecoder.decodeString('$jsonPath.id', json['id']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, "'id'", json);
    }
    String message;
    if (json.containsKey('message')) {
      message = jsonDecoder.decodeString(
        '$jsonPath.message',
        json['message'],
      );
    } else {
      throw jsonDecoder.mismatch(jsonPath, "'message'", json);
    }
    List<String> codes;
    if (json.containsKey('codes')) {
      codes = jsonDecoder.decodeList(
        '$jsonPath.codes',
        json['codes'],
        jsonDecoder.decodeString,
      );
    } else {
      throw jsonDecoder.mismatch(jsonPath, "'codes'", json);
    }
    return FixDescription(id, message, codes);
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'FixDescription'", json);
  }
}