fetchPollList static method
fetchPollList method is used to fetch list of polls/quiz with a given state
Parameters
hmsPollState - hmsPollState
state of the polls/quiz that is required to be fetched
Returns
Future
Refer fetchPollList
Implementation
static Future<dynamic> fetchPollList(
{required HMSPollState hmsPollState}) async {
var result = await PlatformService.invokeMethod(
PlatformMethod.fetchPollList,
arguments: {
"poll_state":
HMSPollStateValues.getStringFromHMSPollState(hmsPollState)
});
if (result != null) {
if (result["success"]) {
if (result["data"] != null) {
List<HMSPoll> polls = [];
result["data"]
.forEach((element) => polls.add(HMSPoll.fromMap(element)));
return polls;
} else {
return null;
}
} else {
if (result["data"]["error"] != null) {
return HMSException.fromMap(result["data"]["error"]);
}
}
}
}