getAllVotes method

Future<List<PollVoteModel?>> getAllVotes()

Implementation

Future<List<PollVoteModel?>> getAllVotes() {
  return _httpService.getAllVotes().then((data) async {
    if (data.statusCode == 200) {
      List<dynamic> tags = json.decode(data.body);
      List<PollVoteModel?> pollVotesList =
          tags.map((i) => PollVoteModel.fromJson(i)).toList();
      return pollVotesList;
    } else {
      return List<PollVoteModel?>.from([]);
    }
  });
}