updatePollOption method

Future<Poll> updatePollOption({
  1. required int pollId,
  2. required int pollOptionId,
  3. required String optionText,
  4. OnPollCallback? onCompleted,
})

Update Poll Option

Implementation

Future<Poll> updatePollOption({
  required int pollId,
  required int pollOptionId,
  required String optionText,
  OnPollCallback? onCompleted,
}) async {
  Poll poll = await _sdk.api
      .send(
    PollOptionUpdateRequest(
      pollId: pollId,
      pollOptionId: pollOptionId,
      text: optionText,
    ),
  )
      .onError((error, stackTrace) {
    if (onCompleted != null) {
      onCompleted(null, SBError(message: 'Failed updating poll option'));
    }
    throw SBError(message: "Failed updating poll option");
  });

  if (onCompleted != null) {
    onCompleted(poll, null);
  }
  return poll;
}