put method

Future<Response> put(
  1. String uri, {
  2. dynamic data,
  3. Map<String, dynamic>? queryParameters,
  4. Options? options,
  5. CancelToken? cancelToken,
  6. ProgressCallback? onSendProgress,
  7. ProgressCallback? onReceiveProgress,
})

Makes a PUT request to the specified uri.

uri: The endpoint to make the PUT request to. data: The data to include in the PUT request body. queryParameters: Optional query parameters to include in the request. options: Optional request options. cancelToken: Optional cancel token to cancel the request. onSendProgress: Optional callback to track the progress of the request. onReceiveProgress: Optional callback to track the progress of the response.

Returns the response from the PUT request.

Implementation

Future<Response> put(
  String uri, {
  data,
  Map<String, dynamic>? queryParameters,
  Options? options,
  CancelToken? cancelToken,
  ProgressCallback? onSendProgress,
  ProgressCallback? onReceiveProgress,
}) async {
  try {
    await _configureDio();
    final Response response = await _dio.put(
      uri,
      data: data,
      queryParameters: queryParameters,
      options: options,
      cancelToken: cancelToken,
      onSendProgress: onSendProgress,
      onReceiveProgress: onReceiveProgress,
    );
    return response;
  } catch (e) {
    rethrow;
  }
}