lab6 с неработающей пагинацией и еще чем то

This commit is contained in:
antoc0der 2024-10-08 21:29:54 +04:00
parent 3a8474593b
commit 06c1f9f37f

View File

@ -22,14 +22,23 @@ class BbcRepository extends ApiInterface {
int pageSize = 10,
}) async {
try {
final String url = '$_baseUrl/everything?q=$q&page=$page&pageSize=$pageSize$_apiKey';
// final String url = '$_baseUrl/everything?q=$q&page=$page&pageSize=$pageSize$_apiKey';
final String url = '$_baseUrl/everything';
final Response<dynamic> response = await _dio.get<Map<dynamic, dynamic>>(
url,
queryParameters: {
queryParameters: ( (q != null && !q.isEmpty) ? {
'q': q,
'page': page,
'pageSize': pageSize,
},
'apikey': 'b9848c2aa43e4a0ba12dfe925db8513c'
} : {
'q': 'news',
'page': page,
'pageSize': pageSize,
'apikey': 'b9848c2aa43e4a0ba12dfe925db8513c'
}
)
);
final NewsDto dto =
NewsDto.fromJson(response.data as Map<String, dynamic>);