create static method

Future<Poll> create({
  1. required PollCreateParams params,
  2. OnPollCallback? onCompleted,
})

Create Poll

Implementation

static Future<Poll> create({
  required PollCreateParams params,
  OnPollCallback? onCompleted,
}) async {
  final sdk = SendbirdSdk().getInternal();
  var poll = await sdk.api
      .send(PollCreateRequest(params: params))
      .onError((error, stackTrace) {
    if (onCompleted != null) {
      onCompleted(null, SBError(message: 'Failed Creating Poll'));
    }
    throw SBError(message: 'Failed Creating Poll');
  });

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

  return poll;
}