AnalysisSetSubscriptionsParams.fromJson constructor

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

Implementation

factory AnalysisSetSubscriptionsParams.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    Map<AnalysisService, List<String>> subscriptions;
    if (json.containsKey('subscriptions')) {
      subscriptions = jsonDecoder.decodeMap(
          '$jsonPath.subscriptions', json['subscriptions'],
          keyDecoder: (String jsonPath, Object? json) =>
              AnalysisService.fromJson(jsonDecoder, jsonPath, json),
          valueDecoder: (String jsonPath, Object? json) => jsonDecoder
              .decodeList(jsonPath, json, jsonDecoder.decodeString));
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'subscriptions');
    }
    return AnalysisSetSubscriptionsParams(subscriptions);
  } else {
    throw jsonDecoder.mismatch(
        jsonPath, 'analysis.setSubscriptions params', json);
  }
}