Submit Poll Vote
The submitPollVote() function is used to submit a vote for a poll. It takes a SubmitPollVoteRequest as input, which includes the pollId and the votes. The function returns an LMResponse<void> response as a Future.
Steps to Submit a Poll Vote
- Create an instance of
SubmitPollVoteRequestwith the required parameters:pollIdandvotes. - Call the
submitPollVote()function using the instance of theLMFeedClientclass, passing the request as a parameter. - Use the response as per your requirement.
// Create an instance of SubmitPollVoteRequest
SubmitPollVoteRequest request = SubmitPollVoteRequest(
pollId: "poll_id",
votes: ["vote1", "vote2"]
);
// Get the response from calling the function
final LMResponse<void> submitPollVoteResponse = await lmFeedClient.submitPollVote(request);
// Process the response, as per requirement
if (submitPollVoteResponse.success) {
// your function to handle successful submission of the poll vote
handleSubmitPollVoteSuccess();
} else {
// your function to handle error message
handleSubmitPollVoteError(submitPollVoteResponse.errorMessage);
}
Models
SubmitPollVoteRequest
List of parameters for the SubmitPollVoteRequest class
| Variable | Type | Description | Optional |
|---|---|---|---|
| pollId | String | Unique identifier of the poll | |
| votes | List<String> | List of votes |