patch static method

Future<Response?> patch(
  1. Uri url, {
  2. Map<String, String>? headers,
  3. Object? body,
  4. Encoding? encoding,
  5. CancellationToken? cancelToken,
  6. int retries = 3,
  7. Duration? timeLimit,
  8. Duration timeRetry = const Duration(milliseconds: 100),
  9. FutureOr<Response> onTimeout()?,
})

Implementation

static Future<Response?> patch(
  Uri url, {
  Map<String, String>? headers,
  Object? body,
  Encoding? encoding,
  CancellationToken? cancelToken,
  int retries = 3,
  Duration? timeLimit,
  Duration timeRetry = const Duration(milliseconds: 100),
  FutureOr<Response> Function()? onTimeout,
}) async {
  cancelToken?.throwIfCancellationRequested();
  return await RetryHelper.tryRun<Response>(
    () {
      return CancellationTokenSource.register(
        cancelToken,
        timeLimit == null
            ? _httpClient.patch(
                url,
                headers: headers,
                body: body,
                encoding: encoding,
              )
            : _httpClient
                .patch(
                  url,
                  headers: headers,
                  body: body,
                  encoding: encoding,
                )
                .timeout(
                  timeLimit,
                  onTimeout: onTimeout,
                ),
      );
    },
    cancelToken: cancelToken,
    timeRetry: timeRetry,
    retries: retries,
  );
}