addPollOption method
Future<Poll>
addPollOption({
- required int pollId,
- required String optionText,
- OnPollCallback? onCompleted,
Add Poll Option
Implementation
Future<Poll> addPollOption({
required int pollId,
required String optionText,
OnPollCallback? onCompleted,
}) async {
Poll poll = await _sdk.api
.send(
PollOptionAddRequest(
pollId: pollId,
text: optionText,
channelUrl: channelUrl,
channelType: channelType,
),
)
.onError((error, stackTrace) {
if (onCompleted != null) {
onCompleted(null, SBError(message: 'Failed adding poll option'));
}
throw SBError(message: "Failed adding poll option");
});
if (onCompleted != null) {
onCompleted(poll, null);
}
return poll;
}