AnalysisSetAnalysisRootsParams.fromJson constructor

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

Implementation

factory AnalysisSetAnalysisRootsParams.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    List<String> included;
    if (json.containsKey('included')) {
      included = jsonDecoder.decodeList(
          '$jsonPath.included', json['included'], jsonDecoder.decodeString);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'included');
    }
    List<String> excluded;
    if (json.containsKey('excluded')) {
      excluded = jsonDecoder.decodeList(
          '$jsonPath.excluded', json['excluded'], jsonDecoder.decodeString);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'excluded');
    }
    Map<String, String>? packageRoots;
    if (json.containsKey('packageRoots')) {
      packageRoots = jsonDecoder.decodeMap(
          '$jsonPath.packageRoots', json['packageRoots'],
          valueDecoder: jsonDecoder.decodeString);
    }
    return AnalysisSetAnalysisRootsParams(included, excluded,
        packageRoots: packageRoots);
  } else {
    throw jsonDecoder.mismatch(
        jsonPath, 'analysis.setAnalysisRoots params', json);
  }
}