put method

Future<Response> put(
  1. String url, {
  2. Map<String, String>? headers,
  3. Object? body,
  4. Encoding? encoding,
})

Sends an HTTP PUT request with the given headers and body to the given url.

Implementation

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