patch function

Future<Response> patch(
  1. Uri url, {
  2. Map<String, String>? headers,
  3. Object? body,
  4. Encoding? encoding,
  5. Duration? timeout,
})

Sends an HTTP PATCH request with the given headers and body to the given URL.

body sets the body of the request. It can be a String, a List<int> or a Map<String, String>. If it's a String, it's encoded using encoding and used as the body of the request. The content-type of the request will default to "text/plain".

If body is a List, it's used as a list of bytes for the body of the request.

If body is a Map, it's encoded as form fields using encoding. The content-type of the request will be set to "application/x-www-form-urlencoded"; this cannot be overridden.

encoding defaults to utf8.

If timeout is not null the request will be aborted if it takes longer than the given duration to complete, and the returned future will complete as an error with a TimeoutException.

For more fine-grained control over the request, use Request or StreamedRequest instead.

Implementation

Future<http.Response> patch(Uri url,
        {Map<String, String>? headers,
        Object? body,
        Encoding? encoding,
        Duration? timeout}) =>
    _withClient((client) => client.patch(url,
        headers: headers, body: body, encoding: encoding, timeout: timeout));