CompletionAvailableSuggestionsParams.fromJson constructor

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

Implementation

factory CompletionAvailableSuggestionsParams.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    List<AvailableSuggestionSet>? changedLibraries;
    if (json.containsKey('changedLibraries')) {
      changedLibraries = jsonDecoder.decodeList(
          '$jsonPath.changedLibraries',
          json['changedLibraries'],
          (String jsonPath, Object? json) =>
              AvailableSuggestionSet.fromJson(jsonDecoder, jsonPath, json));
    }
    List<int>? removedLibraries;
    if (json.containsKey('removedLibraries')) {
      removedLibraries = jsonDecoder.decodeList('$jsonPath.removedLibraries',
          json['removedLibraries'], jsonDecoder.decodeInt);
    }
    return CompletionAvailableSuggestionsParams(
        changedLibraries: changedLibraries,
        removedLibraries: removedLibraries);
  } else {
    throw jsonDecoder.mismatch(
        jsonPath, 'completion.availableSuggestions params', json);
  }
}