getCategories method
Implementation
getCategories(BuildContext context) async {
// Helper.progressDialog(context, "Please wait..");
// printLogs(dio);
await dio
.get(
'${ApiConstant.posBaseUrl}pos-purchase-order-service-svc/pogs',
options: Options(
headers: {
'X-User-Id': storage.read("XUSER_ID"),
'X-Roles': storage.read("XUSER_ID"),
},
),
)
.then((response) {
// Get.back();
if (response.data != null) {
CategoryModel model = CategoryModel();
print('getCategories${response.data}');
Map<String, dynamic> creditData = response.data;
model = CategoryModel.fromJson(creditData);
if (model.status == 'POS200') {
categories = model.data!.list!;
categoryList.value = categories;
}
}
}).catchError((error) {
print(error.toString());
// Get.back();
MainController mainController = Get.put(MainController());
mainController.showErrorPopup();
});
}