callWarehouseListApi method
Implementation
Future<void> callWarehouseListApi(
int pageNumber, String keyword, bool isScroll) async {
BuildContext context = Get.context!;
if (pageNumber == 1) {
Helper.progressDialog(context, "");
}
await ApiClient(baseUrl: ApiConstant.baseUrl)
.getWarehouseList(
xUserId: storage.read("XUSER_ID"),
status: 1,
partnerId: storage.read("PARTNER_ID_LOGIN"),
order: "asc",
size: 10,
page: pageNumber,
keyword: keyword,
)
.then((response) {
isResponseReceived.value = true;
WarehouseModel model = response;
totalWarehouse = model.totalElements ?? 0;
if (pageNumber == 1) {
Get.close(1);
warehouseList.value = model.content ?? [];
searchedwarehouseList.value = warehouseList;
} else {
warehouseList.addAll(model.content ?? []);
searchedwarehouseList.addAll(model.content ?? []);
isLoadingMore.value = false;
}
}).catchError((onError) {
isResponseReceived.value = false;
if (pageNumber > 1) {
isLoadingMore.value = false;
}
if (pageNumber == 1) {
Get.close(1);
}
MainController mainController = Get.put(MainController());
mainController.showErrorPopup();
});
}