AnalysisGetReachableSourcesResult.fromJson constructor

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

Implementation

factory AnalysisGetReachableSourcesResult.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    Map<String, List<String>> sources;
    if (json.containsKey('sources')) {
      sources = jsonDecoder.decodeMap('$jsonPath.sources', json['sources'],
          valueDecoder: (String jsonPath, Object? json) => jsonDecoder
              .decodeList(jsonPath, json, jsonDecoder.decodeString));
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'sources');
    }
    return AnalysisGetReachableSourcesResult(sources);
  } else {
    throw jsonDecoder.mismatch(
        jsonPath, 'analysis.getReachableSources result', json);
  }
}