чиню поиск
This commit is contained in:
parent
2d28208440
commit
f49a119d5c
@ -24,9 +24,9 @@ class PokemonDataDto {
|
|||||||
final String? name;
|
final String? name;
|
||||||
final String? url;
|
final String? url;
|
||||||
final String? imageUrl;
|
final String? imageUrl;
|
||||||
final int? height; // Добавлено поле для роста
|
final int? height;
|
||||||
final int? weight; // Добавлено поле для веса
|
final int? weight;
|
||||||
final List<AbilityDto>? abilities; // Добавлено поле для способностей
|
final List<AbilityDto>? abilities;
|
||||||
|
|
||||||
const PokemonDataDto({
|
const PokemonDataDto({
|
||||||
this.name,
|
this.name,
|
||||||
|
@ -19,18 +19,22 @@ class PokeRepository extends ApiInterface {
|
|||||||
OnErrorCallback? onError,
|
OnErrorCallback? onError,
|
||||||
String? q,
|
String? q,
|
||||||
int page = 0,
|
int page = 0,
|
||||||
int pageSize = 10,
|
int pageSize = 5,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
String url = '$_baseUrl/pokemon';
|
String url = '$_baseUrl/pokemon';
|
||||||
|
|
||||||
final Map<String, dynamic> queryParameters = {
|
Map<String, dynamic> queryParameters = {
|
||||||
'offset': page,
|
'offset': page,
|
||||||
'limit': pageSize,
|
'limit': pageSize,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (q != null && q.isNotEmpty) {
|
if (q != null && q.isNotEmpty) {
|
||||||
url = '$_baseUrl/pokemon/$q';
|
url = '$_baseUrl/pokemon/$q';
|
||||||
|
queryParameters = {
|
||||||
|
'offset': page,
|
||||||
|
'limit': pageSize,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
final Response<dynamic> response = await _dio.get<Map<dynamic, dynamic>>(
|
final Response<dynamic> response = await _dio.get<Map<dynamic, dynamic>>(
|
||||||
|
Loading…
Reference in New Issue
Block a user