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
- Create an instance of
AddPollOptionRequestwith the required parameters:pollIdandtext. - Call the
addPollOption()function using the instance of theLMFeedClientclass, passing the request as a parameter. - 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
| Variable | Type | Description | Optional |
|---|---|---|---|
| pollId | String | Unique identifier of the poll | |
| text | String | Text of the new option |
AddPollOptionResponse
List of parameters for the AddPollOptionResponse class
| Variable | Type | Description | Optional |
|---|---|---|---|
| widget | WidgetModel | The added poll option entity |