batchWrite method

Applies a batch of write operations.

The BatchWrite method does not apply the write operations atomically and can apply them out of order. Method does not allow more than one write per document. Each write succeeds or fails independently. See the BatchWriteResponse for the success status of each write.

If you require an atomically applied set of writes, use Commit instead.

Throws a http.ClientException if there were problems communicating with the API service. Throws a ServiceException if the API method failed for any reason.

Implementation

Future<BatchWriteResponse> batchWrite(BatchWriteRequest request) async {
  final url = _endPoint.replace(
    path: '/v1/${request.database}/documents:batchWrite',
  );
  final response = await _client.post(url, body: request);
  return BatchWriteResponse.fromJson(response);
}