AnalysisGetImportedElementsResult.fromJson constructor

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

Implementation

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