AnalysisSetPriorityFilesParams.fromJson constructor

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

Implementation

factory AnalysisSetPriorityFilesParams.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  json ??= {};
  if (json is! Map) {
    throw jsonDecoder.mismatch(
      jsonPath,
      "'analysis.setPriorityFiles params'",
      json,
    );
  }
  List<String> files;
  if (json case {'files': var encodedFiles}) {
    files = jsonDecoder.decodeList(
      '$jsonPath.files',
      encodedFiles,
      (String jsonPath, Object? json) =>
          clientUriConverter?.fromClientFilePath(
            jsonDecoder.decodeString(jsonPath, json),
          ) ??
          jsonDecoder.decodeString(jsonPath, json),
    );
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'files'", json);
  }
  return AnalysisSetPriorityFilesParams(files);
}