getAllOptions method

Future<List<PollOptionModel>> getAllOptions()

Implementation

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