AnalysisGetErrorsResult.fromJson constructor

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

Implementation

factory AnalysisGetErrorsResult.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    List<AnalysisError> errors;
    if (json.containsKey('errors')) {
      errors = jsonDecoder.decodeList(
          '$jsonPath.errors',
          json['errors'],
          (String jsonPath, Object? json) =>
              AnalysisError.fromJson(jsonDecoder, jsonPath, json));
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'errors');
    }
    return AnalysisGetErrorsResult(errors);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'analysis.getErrors result', json);
  }
}