BulkFixDetail.fromJson constructor

BulkFixDetail.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json
)

Implementation

factory BulkFixDetail.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    String code;
    if (json.containsKey('code')) {
      code = jsonDecoder.decodeString('$jsonPath.code', json['code']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'code');
    }
    int occurrences;
    if (json.containsKey('occurrences')) {
      occurrences =
          jsonDecoder.decodeInt('$jsonPath.occurrences', json['occurrences']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'occurrences');
    }
    return BulkFixDetail(code, occurrences);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'BulkFixDetail', json);
  }
}