update method

void update(
  1. String recordId, {
  2. Map<String, dynamic> body = const {},
  3. Map<String, dynamic> query = const {},
  4. List<MultipartFile> files = const [],
  5. Map<String, String> headers = const {},
  6. String? expand,
  7. String? fields,
})

Registers a record update request into the current batch queue.

Implementation

void update(
  String recordId, {
  Map<String, dynamic> body = const {},
  Map<String, dynamic> query = const {},
  List<http.MultipartFile> files = const [],
  Map<String, String> headers = const {},
  String? expand,
  String? fields,
}) {
  final enrichedQuery = Map<String, dynamic>.of(query);
  enrichedQuery["expand"] ??= expand;
  enrichedQuery["fields"] ??= fields;

  final request = _BatchRequest(
    method: "PATCH",
    files: files,
    url: _batch.dummyClient
        .buildURL(
          "/api/collections/${Uri.encodeComponent(_collectionIdOrName)}/records/${Uri.encodeComponent(recordId)}",
          enrichedQuery,
        )
        .toString(),
    headers: headers,
    body: body,
  );

  _batch._requests.add(request);
}