CompletionRegisterLibraryPathsParams.fromJson constructor

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

Implementation

factory CompletionRegisterLibraryPathsParams.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    List<LibraryPathSet> paths;
    if (json.containsKey('paths')) {
      paths = jsonDecoder.decodeList(
          '$jsonPath.paths',
          json['paths'],
          (String jsonPath, Object? json) =>
              LibraryPathSet.fromJson(jsonDecoder, jsonPath, json));
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'paths');
    }
    return CompletionRegisterLibraryPathsParams(paths);
  } else {
    throw jsonDecoder.mismatch(
        jsonPath, 'completion.registerLibraryPaths params', json);
  }
}