put method

Future<Map<String, dynamic>> put(
  1. String endpoint, {
  2. Map<String, String>? headers,
  3. Map<String, dynamic>? body,
})

Makes a PUT request to the specified endpoint

Implementation

Future<Map<String, dynamic>> put(
  String endpoint, {
  Map<String, String>? headers,
  Map<String, dynamic>? body,
}) async {
  final uri = _buildUri(endpoint);
  final request = http.Request('PUT', uri);

  request.headers.addAll({'Content-Type': 'application/json'});

  if (headers != null) {
    request.headers.addAll(headers);
  }

  if (body != null) {
    request.body = jsonEncode(body);
  }

  return _executeRequest(request);
}