closePoll method

Future<Poll> closePoll({
  1. required int pollId,
  2. OnPollCallback? onCompleted,
})

Close Poll

Implementation

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