createPollOption method

Future<PollOptionModel?> createPollOption(
  1. dynamic pollQuestion,
  2. dynamic option
)

Implementation

Future<PollOptionModel?> createPollOption(pollQuestion, option) {
  Log(
    logName: 'CreatePollOption',
    className: 'Poll',
    methodName: 'createPollOption',
    type: 'INFO',
    text:
        '{event: Create Poll Option, user: ${currentUser?.userPayloadId}, user is ${currentUser?.firstName} ${currentUser?.lastName}, poll question: $pollQuestion, option: $option',
  );
  return _httpService
      .createPollOption(pollQuestion: pollQuestion, option: option)
      .then((data) async {
    if (data.statusCode >= 200 && data.statusCode < 300) {
      var res = json.decode(data.body);

      PollOptionModel pollOptionData = PollOptionModel.fromJson(res[0]);
      return pollOptionData;
    }
    return null;
  });
}