чиню поиск

This commit is contained in:
Полина Чубыкина 2024-11-18 15:05:17 +04:00
parent 2d28208440
commit f49a119d5c
2 changed files with 9 additions and 5 deletions

View File

@ -24,9 +24,9 @@ class PokemonDataDto {
final String? name;
final String? url;
final String? imageUrl;
final int? height; // Добавлено поле для роста
final int? weight; // Добавлено поле для веса
final List<AbilityDto>? abilities; // Добавлено поле для способностей
final int? height;
final int? weight;
final List<AbilityDto>? abilities;
const PokemonDataDto({
this.name,

View File

@ -19,18 +19,22 @@ class PokeRepository extends ApiInterface {
OnErrorCallback? onError,
String? q,
int page = 0,
int pageSize = 10,
int pageSize = 5,
}) async {
try {
String url = '$_baseUrl/pokemon';
final Map<String, dynamic> queryParameters = {
Map<String, dynamic> queryParameters = {
'offset': page,
'limit': pageSize,
};
if (q != null && q.isNotEmpty) {
url = '$_baseUrl/pokemon/$q';
queryParameters = {
'offset': page,
'limit': pageSize,
};
}
final Response<dynamic> response = await _dio.get<Map<dynamic, dynamic>>(