mirror of
https://github.com/dstark5/Openlib.git
synced 2025-05-17 22:46:00 +08:00
@ -46,10 +46,11 @@ class OpenLibrary {
|
||||
receiveTimeout: const Duration(seconds: 20)));
|
||||
return _parser('${response.data.toString()}${response2.data.toString()}');
|
||||
} on DioException catch (e) {
|
||||
if (e.type == DioExceptionType.unknown) {
|
||||
throw "socketException";
|
||||
}
|
||||
rethrow;
|
||||
return [];
|
||||
// if (e.type == DioExceptionType.unknown) {
|
||||
// throw "socketException";
|
||||
// }
|
||||
// rethrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -94,10 +95,11 @@ class GoodReads {
|
||||
receiveTimeout: const Duration(seconds: 20)));
|
||||
return _parser(response.data.toString());
|
||||
} on DioException catch (e) {
|
||||
if (e.type == DioExceptionType.unknown) {
|
||||
throw "socketException";
|
||||
}
|
||||
rethrow;
|
||||
return [];
|
||||
// if (e.type == DioExceptionType.unknown) {
|
||||
// throw "socketException";
|
||||
// }
|
||||
// rethrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -142,10 +144,11 @@ class PenguinRandomHouse {
|
||||
receiveTimeout: const Duration(seconds: 20)));
|
||||
return _parser(response.data.toString());
|
||||
} on DioException catch (e) {
|
||||
if (e.type == DioExceptionType.unknown) {
|
||||
throw "socketException";
|
||||
}
|
||||
rethrow;
|
||||
return [];
|
||||
// if (e.type == DioExceptionType.unknown) {
|
||||
// throw "socketException";
|
||||
// }
|
||||
// rethrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,12 +77,15 @@ final getTrendingBooks = FutureProvider<List<TrendingBookData>>((ref) async {
|
||||
PenguinRandomHouse penguinTrending = PenguinRandomHouse();
|
||||
List<TrendingBookData> trendingBooks =
|
||||
await Future.wait<List<TrendingBookData>>([
|
||||
openLibrary.trendingBooks(),
|
||||
goodReads.trendingBooks(),
|
||||
penguinTrending.trendingBooks()
|
||||
penguinTrending.trendingBooks(),
|
||||
openLibrary.trendingBooks(),
|
||||
]).then((List<List<TrendingBookData>> listOfData) =>
|
||||
listOfData.expand((element) => element).toList());
|
||||
|
||||
if(trendingBooks.isEmpty){
|
||||
throw 'Nothing Trending Today :(';
|
||||
}
|
||||
trendingBooks.shuffle();
|
||||
return trendingBooks;
|
||||
});
|
||||
|
Reference in New Issue
Block a user