fetchAfterId method
Implementation
@override
Future<void> fetchAfterId(String afterId,
{Map<String, dynamic>? params, bool isMock = false}) async {
try {
this.toLoadingStatus();
late Map<String, dynamic> data;
if (params == null) {
params = {};
}
if (isMock) {
await TimeHelper.sleep();
data = {"items": this.options.getMockItems()?.sublist(0, 6)};
} else {
Response response =
await Requester.get(this.options.getBaseUrl(), params);
Map<String, dynamic> js = json.decode(utf8.decode(response.bodyBytes));
data = js;
}
this._items = [
...(this._items ?? []),
...(data["items"] ?? []),
];
this.itemsSC.add(this.items);
this.toLoadedStatus();
} catch (e) {
this.alertError(e);
this.toErrorStatus(e);
}
}