httpDelete method

Future httpDelete(
  1. String endPoint, {
  2. Map<String, String>? headers,
})

Sends an HTTP DELETE request with the given headers to the given URL, which can be a Uri or a String. endPoint - end point of current url example: current string is www.mydomain.com endpoint param - user result request -> www.mydomain.com/user

Implementation

Future<dynamic> httpDelete(String endPoint, {Map<String, String>? headers}) async {
  if (this.isEmptyOrNull) return;

  try {
    final response = await http.delete(Uri.http(this, endPoint), headers: headers);
    return response.statusCode == 200
        ? convert.jsonDecode(response.body)
        : print('Request failed with status: ${response.statusCode}.');
  } on Exception catch (e) {
    return Future.error(e);
  }
}