AnalysisSetConfigurationsParams.fromJson constructor

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

Implementation

factory AnalysisSetConfigurationsParams.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  json ??= {};
  if (json is! Map) {
    throw jsonDecoder.mismatch(
      jsonPath,
      "'analysis.setConfigurations params'",
      json,
    );
  }
  Map<String, Map<String, PluginConfiguration>> configurations;
  if (json case {'configurations': var encodedConfigurations}) {
    configurations = jsonDecoder.decodeMap(
      '$jsonPath.configurations',
      encodedConfigurations,
      keyDecoder: (String jsonPath, Object? json) =>
          clientUriConverter?.fromClientFilePath(
            jsonDecoder.decodeString(jsonPath, json),
          ) ??
          jsonDecoder.decodeString(jsonPath, json),
      valueDecoder: (String jsonPath, Object? json) => jsonDecoder.decodeMap(
        jsonPath,
        json,
        valueDecoder: (String jsonPath, Object? json) =>
            PluginConfiguration.fromJson(
              jsonDecoder,
              jsonPath,
              json,
              clientUriConverter: clientUriConverter,
            ),
      ),
    );
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'configurations'", json);
  }
  return AnalysisSetConfigurationsParams(configurations);
}