oldelete method

Future oldelete(
  1. String endPoint,
  2. Map data
)

Make a custom delete request to Woocommerce, using WooCommerce SDK.

Implementation

Future<dynamic> oldelete(String endPoint, Map data) async {
  String url = this._getOAuthURL("DELETE", endPoint);

  http.Client client = http.Client();
  http.Request request = http.Request('DELETE', Uri.parse(url));
  request.headers[HttpHeaders.contentTypeHeader] =
      'application/json; charset=utf-8';
  //request.headers[HttpHeaders.authorizationHeader] = _urlHeader['Authorization'];
  request.headers[HttpHeaders.cacheControlHeader] = "no-cache";
  request.body = json.encode(data);
  final response =
      await client.send(request).then((res) => res.stream.bytesToString());
  _printToLog("this is the delete's response : " + response.toString());
  var dataResponse = await json.decode(response);
  _handleHttpError(dataResponse);
  return dataResponse;
}