apiGet method
Implementation
Future apiGet(isFirst, [Map<String, dynamic>? queries, int? initPage]) async {
if (isFirst) {
page = initPage ?? _page;
hashNextPage = true;
}
if (!hashNextPage) throw Exception('No more data');
Map<String, dynamic> query = {
_offset: page,
_limit: '$limit',
};
if (queries != null) {
query.addAll(queries);
}
debugPrint('ApiLoadMore $query');
nexPage();
final res = await apiCall(query);
debugPrint('ApiClientgetProductStatus $res');
if (res['success']) {
final list = modelHanlde(res[_data]);
if (list.length < limit) {
hashNextPage = false;
}
return list;
}
return error(res);
}