post static method
Implementation
static Future<Response?> post(
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.post(
url,
headers: headers,
body: body,
encoding: encoding,
)
: _httpClient
.post(
url,
headers: headers,
body: body,
encoding: encoding,
)
.timeout(
timeLimit,
onTimeout: onTimeout,
),
);
},
cancelToken: cancelToken,
timeRetry: timeRetry,
retries: retries,
);
}