EditGetAvailableRefactoringsResult.fromJson constructor

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

Implementation

factory EditGetAvailableRefactoringsResult.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    List<RefactoringKind> kinds;
    if (json.containsKey('kinds')) {
      kinds = jsonDecoder.decodeList(
          '$jsonPath.kinds',
          json['kinds'],
          (String jsonPath, Object? json) =>
              RefactoringKind.fromJson(jsonDecoder, jsonPath, json));
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'kinds');
    }
    return EditGetAvailableRefactoringsResult(kinds);
  } else {
    throw jsonDecoder.mismatch(
        jsonPath, 'edit.getAvailableRefactorings result', json);
  }
}