readingBooks method

Future<List<Book>> readingBooks()

Implementation

Future<List<Book>> readingBooks() async {
  Uri uri = _httpClient.config.generateApiUri('/reading');
  http.Response res = await _httpClient.get(uri);
  Map json = jsonDecode(res.body);
  List<Book> books = [];

  for(int i = 0;i < json['books'].length; i++){
    Map book = json['books'][i];
    books.add(
        Book(
            book['id'],
            await this._cacheController.getLibraryCache().getById(book['library']),
            book['name'],
            _cacheController,
            _httpClient
        )
    );
  }
  return books;
}