AnalysisOutlineParams.fromJson constructor

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

Implementation

factory AnalysisOutlineParams.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    String file;
    if (json.containsKey('file')) {
      file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'file');
    }
    FileKind kind;
    if (json.containsKey('kind')) {
      kind = FileKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'kind');
    }
    String? libraryName;
    if (json.containsKey('libraryName')) {
      libraryName = jsonDecoder.decodeString(
          '$jsonPath.libraryName', json['libraryName']);
    }
    Outline outline;
    if (json.containsKey('outline')) {
      outline =
          Outline.fromJson(jsonDecoder, '$jsonPath.outline', json['outline']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'outline');
    }
    return AnalysisOutlineParams(file, kind, outline,
        libraryName: libraryName);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'analysis.outline params', json);
  }
}