Skip to main content

Get Poll Votes

The getPollVotes() function is used to fetch the votes for a poll. It takes a GetPollVotesRequest as input, which includes the pollId, votes, page, and pageSize. The function returns an LMResponse<GetPollVotesResponse> as a Future.

Steps to Get Poll Votes

  1. Create an instance of GetPollVotesRequest with the required parameters: pollId and votes. Optionally, you can also include page and pageSize.
  2. Call the getPollVotes() 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 GetPollVotesRequest
GetPollVotesRequest request = GetPollVotesRequest()
..pollId = "poll_id"
..votes = ["vote1", "vote2"]
..page = 1
..pageSize = 10;

// Get the response from calling the function
final LMResponse<GetPollVotesResponse> getPollVotesResponse = await lmFeedClient.getPollVotes(request);

// Process the response, as per requirement
if (getPollVotesResponse.success) {
// your function to handle successful retrieval of poll votes
handleGetPollVotesSuccess(getPollVotesResponse.data.votes);
} else {
// your function to handle error message
handleGetPollVotesError(getPollVotesResponse.errorMessage);
}

Models

GetPollVotesRequest

List of parameters for the GetPollVotesRequest class

VariableTypeDescriptionOptional
pollIdStringUnique identifier of the poll
votesList<String>List of votes
pageintPage number for pagination
pageSizeintNumber of items per page

GetPollVotesResponse

List of parameters for the GetPollVotesResponse class

VariableTypeDescriptionOptional
topicsMap<String, Topic>Map of topics
userTopicsMap<String, List<String>>Map of user topics
usersMap<String, User>Map of users
widgetsMap<String, WidgetModel>Map of widgets
votesList<Vote>List of poll votes