put function

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

Implementation

Future<http.Response> put(String url, {Map<String, String>? headers, Object? body, int? timeOut}) async {
  final Map<String, dynamic> request = {
    "method": "PUT",
    "url": url,
    "headers": headers ?? const <String, String>{},
    "body": body ?? "",
    "timeOut": Duration(seconds: timeOut ?? _timeOut).inMilliseconds
  };
  if (_useNative){
    return await _sendRequest(request);
  } else {
    return await http.put(
        Uri.parse(url),
        headers: headers,
        encoding: Encoding.getByName("UTF-8"),
        body: body
    ).timeout(Duration(seconds: timeOut ?? _timeOut));
  }
}