AnalysisOutlineParams.fromJson constructor

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

Implementation

factory AnalysisOutlineParams.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json,
    {ClientUriConverter? clientUriConverter}) {
  json ??= {};
  if (json is Map) {
    String file;
    if (json.containsKey('file')) {
      file = clientUriConverter?.fromClientFilePath(
              jsonDecoder.decodeString('$jsonPath.file', json['file'])) ??
          jsonDecoder.decodeString('$jsonPath.file', json['file']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'file');
    }
    List<Outline> outline;
    if (json.containsKey('outline')) {
      outline = jsonDecoder.decodeList(
          '$jsonPath.outline',
          json['outline'],
          (String jsonPath, Object? json) => Outline.fromJson(
              jsonDecoder, jsonPath, json,
              clientUriConverter: clientUriConverter));
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'outline');
    }
    return AnalysisOutlineParams(file, outline);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'analysis.outline params', json);
  }
}