deleteMyCartItem method

Future deleteMyCartItem({
  1. required String key,
})

Implementation

Future deleteMyCartItem({required String key}) async {
  Map<String, dynamic> data = {
    'key': key,
  };
  _printToLog('Deleting CartItem With Payload : ' + data.toString());
  await getAuthTokenFromDb();
  _urlHeader['Authorization'] = 'Bearer ' + _authToken!;

  final http.Response response = await http.delete(
    Uri.parse(this.baseUrl + URL_STORE_API_PATH + 'cart/items/' + key),
    headers: _urlHeader,
  );
  _printToLog('response of delete cart  : ' + response.body.toString());

  if (response.statusCode >= 200 && response.statusCode < 300) {
    _printToLog(
        'response of delete cart oooo   : ' + response.body.toString());
    //final jsonStr = json.decode(response.body);

    //_printToLog('added to my cart : '+jsonStr.toString());
    //return WooCartItem.fromJson(jsonStr);
    return response.body;
  } else {
    WooCommerceError err =
        WooCommerceError.fromJson(json.decode(response.body));
    throw err;
  }
}