delete method

Future<Response> delete(
  1. String url, {
  2. Map<String, String>? headers,
})

Sends an HTTP DELETE request with the given headers to the given url.

Implementation

Future<http.Response> delete(
  String url, {
  Map<String, String>? headers,
}) async =>
    await retry(
      () => client
          .delete(
            Uri.parse(Uri.encodeFull(url)),
            headers: headers,
          )
          .timeout(const Duration(seconds: 15)),
      delayFactor: const Duration(seconds: 5),
      maxAttempts: 15,
      retryIf: (e) => e is SocketException || e is TimeoutException,
      onRetry: (e) =>
          debugPrint('${e.runtimeType} - Retrying to DELETE $url'),
    );