votePoll method Null safety
- {required int pollId,
- required List<
int> pollOptionIds, - OnPollCallback? onCompleted}
Cast/ Cancel Poll Vote
Implementation
Future<Poll> votePoll({
required int pollId,
required List<int> pollOptionIds,
OnPollCallback? onCompleted,
}) async {
Poll poll = await _sdk.api
.send(
PollVoteRequest(
pollId: pollId,
pollOptionIds: pollOptionIds,
channelUrl: channelUrl,
channelType: channelType,
),
)
.onError((error, stackTrace) {
if (onCompleted != null) {
onCompleted(null, SBError(message: "Failed voting poll"));
}
throw SBError(message: "Failed voting poll");
});
if (onCompleted != null) {
onCompleted(poll, null);
}
return poll;
}