getAllStories method

Future<List<StoryModel>> getAllStories()

Implementation

Future<List<StoryModel>> getAllStories() {
  return _httpService.getAllStories().then((data) async {
    if (data.statusCode == 200) {
      List<dynamic> story = json.decode(data.body);
      List<StoryModel> storiesList =
          story.map((i) => StoryModel.fromJson(i)).toList();
      return storiesList;
    } else {
      return List<StoryModel>.from([]);
    }
  });
}