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
- Create an instance of
GetPollVotesRequest
with the required parameters:pollId
andvotes
. Optionally, you can also includepage
andpageSize
. - Call the
getPollVotes()
function using the instance of theLMFeedClient
class, passing the request as a parameter. - 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
Variable | Type | Description | Optional |
---|---|---|---|
pollId | String | Unique identifier of the poll | |
votes | List<String> | List of votes | |
page | int | Page number for pagination | ✔ |
pageSize | int | Number of items per page | ✔ |
GetPollVotesResponse
List of parameters for the GetPollVotesResponse
class
Variable | Type | Description | Optional |
---|---|---|---|
topics | Map<String, Topic> | Map of topics | |
userTopics | Map<String, List<String>> | Map of user topics | ✔ |
users | Map<String, User> | Map of users | |
widgets | Map<String, WidgetModel> | Map of widgets | |
votes | List<Vote> | List of poll votes |