Search From 5 (1)
This commit is contained in:
parent
65217136a8
commit
e52ab22a31
@ -16,12 +16,16 @@ class AnimeRepository extends ApiInterface {
|
|||||||
static const String _baseUrl = 'https://api.jikan.moe';
|
static const String _baseUrl = 'https://api.jikan.moe';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<CardData>?> loadData() async{
|
Future<List<CardData>?> loadData({String? q}) async{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const String url = '$_baseUrl/v4/anime';
|
const String url = '$_baseUrl/v4/anime';
|
||||||
final Response<dynamic> response = await _dio.get<Map<dynamic, dynamic>>(url);
|
Map<String, dynamic> query = {'limit' : 5, 'q' : q};
|
||||||
|
final Response<dynamic> response =
|
||||||
|
await _dio.get<Map<dynamic, dynamic>>(
|
||||||
|
url,
|
||||||
|
queryParameters: query,
|
||||||
|
);
|
||||||
final AnimesDto dto = AnimesDto.fromJson(response.data as Map<String, dynamic>);
|
final AnimesDto dto = AnimesDto.fromJson(response.data as Map<String, dynamic>);
|
||||||
final List<CardData>? data = dto.data?.map((e) => e.toDomain()).toList();
|
final List<CardData>? data = dto.data?.map((e) => e.toDomain()).toList();
|
||||||
return data;
|
return data;
|
||||||
|
Loading…
Reference in New Issue
Block a user