EditGetAvailableRefactoringsResult.fromJson constructor

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

Implementation

factory EditGetAvailableRefactoringsResult.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  json ??= {};
  if (json is! Map) {
    throw jsonDecoder.mismatch(
      jsonPath,
      "'edit.getAvailableRefactorings result'",
      json,
    );
  }
  List<RefactoringKind> kinds;
  if (json case {'kinds': var encodedKinds}) {
    kinds = jsonDecoder.decodeList(
      '$jsonPath.kinds',
      encodedKinds,
      (String jsonPath, Object? json) => RefactoringKind.fromJson(
        jsonDecoder,
        jsonPath,
        json,
        clientUriConverter: clientUriConverter,
      ),
    );
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'kinds'", json);
  }
  return EditGetAvailableRefactoringsResult(kinds);
}