getProducts method
Implementation
Future<List<OfferList>?> getProducts(
BuildContext context, String categoryId) async {
Helper.progressDialog(context, "Please wait..");
int buyerType = storage.read("LEVEL_ID");
int sellerType = storage.read("DISTRIBUTER_LEVEL_ID");
String buyerTypeEntityId = partnerId;
// String buyerTypeEntityId = "10091";
String sellerTypeEntityId = isDealerFlow
? storage.read("DISTRIBUTER_ID")
: storage.read("PARTNER_ID_LOGIN");
// printLogs(dio);
try {
var response = await dio.get(
'${ApiConstant.posBaseUrl}pos-purchase-order-service-svc/offers',
queryParameters: {
"pogId": categoryId,
"sellerType": "$sellerType",
"buyerType": "$buyerType",
"buyerEntityId": buyerTypeEntityId,
"sellerEntityId": sellerTypeEntityId,
"currencyType": "USD",
},
options: Options(
headers: {
'X-User-Id': storage.read("XUSER_ID"),
'X-Roles': storage.read("XUSER_ID")
},
),
);
Get.back();
ProductModel model = ProductModel.fromJson(response.data);
return model.data?.offerList;
} catch (e) {
Get.back();
return [];
}
}