put static method

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

Makes a PUT request to the specified url. The url can be either a String or a Uri object.

Implementation

static Future<http.Response> put(
  Object url, {
  Map<String, String>? headers,
  Object? body,
  Encoding? encoding,
}) async {
  try {
    final uri = _toUri(url);
    return _client.put(uri, headers: headers, body: body, encoding: encoding);
  } catch (e) {
    if (e is HTTPSException) {
      rethrow;
    } else {
      Error.throwWithStackTrace(
        HTTPSException(
          message: 'Failed to make PUT request to $url: ${e.toString()}',
          originalError: e,
        ),
        StackTrace.current,
      );
    }
  }
}