fetch method
Implementation
@override
Future<void> fetch({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()};
} else {
Response response =
await Requester.get(this.options.getBaseUrl(), params);
Map<String, dynamic> js = json.decode(utf8.decode(response.bodyBytes));
data = js;
}
this._items = data["items"];
this.itemsSC.add(this.items);
this.toLoadedStatus();
} catch (e) {
this.alertError(e);
this.toErrorStatus(e);
}
}