TestDeletToCart method
Future
TestDeletToCart(
{ - dynamic cartId,
- dynamic context,
})
Implementation
Future TestDeletToCart({cartId, context}) async {
var decodedResponse;
final ApiBody = {"cartId": "${cartId}", "clear_cart": false};
try {
Map data = ApiBody;
var body = jsonEncode(data);
final response = await http.post(
Uri.parse('${WELLNESS_URL}api/diagnostic/delete-cart-item'),
headers: {
'Authorization': currentUserToken,
"Content-Type": "application/json"
},
body: body,
);
decodedResponse = json.decode(response.body);
if (decodedResponse['success'] == true) {
return null;
} else {
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return PinCodePopUp(
messag: "${decodedResponse['message']}",
image: '${LottiePath}Error.json',
);
},
);
}
} catch (e) {
ErrorListner(
apiname: 'api/diagnostic/delete-cart-item',
responsed: "${decodedResponse}",
request: "${ApiBody}",
app_error: '${e}');
}
}