AnalysisErrorFixes.fromJson constructor

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

Implementation

factory AnalysisErrorFixes.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json,
    {ClientUriConverter? clientUriConverter}) {
  json ??= {};
  if (json is Map) {
    AnalysisError error;
    if (json.containsKey('error')) {
      error = AnalysisError.fromJson(
          jsonDecoder, '$jsonPath.error', json['error'],
          clientUriConverter: clientUriConverter);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'error');
    }
    List<PrioritizedSourceChange> fixes;
    if (json.containsKey('fixes')) {
      fixes = jsonDecoder.decodeList(
          '$jsonPath.fixes',
          json['fixes'],
          (String jsonPath, Object? json) => PrioritizedSourceChange.fromJson(
              jsonDecoder, jsonPath, json,
              clientUriConverter: clientUriConverter));
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'fixes');
    }
    return AnalysisErrorFixes(error, fixes: fixes);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'AnalysisErrorFixes', json);
  }
}