Skip to main content

Add Poll Option

The addPollOption() function is used to add a new option to an existing poll. It takes an AddPollOptionRequest as input, which includes the pollId and the text. The function returns an LMResponse<AddPollOptionResponse> as a Future.

Steps to Add a Poll Option

  1. Create an instance of AddPollOptionRequest with the required parameters: pollId and text.
  2. Call the addPollOption() function using the instance of the LMFeedClient class, passing the request as a parameter.
  3. Use the response as per your requirement.
// Create an instance of AddPollOptionRequest
AddPollOptionRequest request = AddPollOptionRequest()
..pollId = "poll_id"
..text = "New Option";

// Get the response from calling the function
final LMResponse<AddPollOptionResponse> addPollOptionResponse = await lmFeedClient.addPollOption(request);

// Process the response, as per requirement
if (addPollOptionResponse.success) {
// your function to handle successful addition of the poll option
handleAddPollOptionSuccess(addPollOptionResponse.data.widget);
} else {
// your function to handle error message
handleAddPollOptionError(addPollOptionResponse.errorMessage);
}

Models

AddPollOptionRequest

List of parameters for the AddPollOptionRequest class

VariableTypeDescriptionOptional
pollIdStringUnique identifier of the poll
textStringText of the new option

AddPollOptionResponse

List of parameters for the AddPollOptionResponse class

VariableTypeDescriptionOptional
widgetWidgetModelThe added poll option entity