vote method
void
vote()
this method is the one who handles the vote. It calls the onVoted callback and if the return is true then changes the voting session to voted.
Implementation
void vote() async {
bool response = true;
final option =
options.firstWhere((element) => element.id == selectedOption);
if (onVoted != null) {
response = await runBusyFuture(onVoted!.call(option, option.votes + 1),
busyObject: _loading);
}
if (response) {
votedOption = selectedOption!;
hasVoted = true;
notifyListeners();
}
}