updatePoll method

Future<Poll> updatePoll({
  1. required int pollId,
  2. required PollUpdateParams params,
  3. OnPollCallback? onCompleted,
})

Updates Poll

Implementation

Future<Poll> updatePoll({
  required int pollId,
  required PollUpdateParams params,
  OnPollCallback? onCompleted,
}) async {
  Poll poll = await _sdk.api
      .send(
    PollUpdateRequest(
      pollId: pollId,
      params: params,
    ),
  )
      .onError((error, stackTrace) {
    if (onCompleted != null) {
      onCompleted(null, SBError(message: 'Failed updating poll'));
    }
    throw SBError(message: "Failed updating poll");
  });
  if (onCompleted != null) {
    onCompleted(poll, null);
  }
  return poll;
}