getStories method

Future<List<Story>> getStories()

Function used to access stories which returns List<Story>

Implementation

Future<List<Story>> getStories() async {
  final List<http.Response> responses = await _getStories();

  final List<Story> stories = responses.map((response) {
    final json = jsonDecode(response.body);

    return Story.fromJson(json);
  }).toList();

  return stories;
}