executeDelete method Null safety

void executeDelete(
  1. {required String objectTypeName,
  2. required List<Map<String, dynamic>> entries}
)

This method is called to delete a group of objects from a Cloud DB zone on the cloud in a transaction in batches. A transaction is atomic. All operations in a transaction will either be successful or fail. The delete operation focuses only on whether the primary key of the object is consistent, regardless of whether other attributes of the object match the stored data.

Comply with the following rules when calling this method:

  • This method can be called to delete data only when the network is properly connected.
  • The synchronization property of Cloud DB zone is cache mode.
  • The data size of multiple write and delete operations in a transaction must be less than or equal to 2 MB. Otherwise, the transaction fails.

Implementation

void executeDelete({
  required String objectTypeName,
  required List<Map<String, dynamic>> entries,
}) {
  if (objectTypeName.isEmpty) {
    throw FormatException(
        'objectTypeName cannot be an empty string.', objectTypeName);
  }
  if (entries.isEmpty) {
    throw FormatException('entries cannot be an empty list.', entries);
  }
  _transactionElements.add(
    <String, dynamic>{
      _TransactionConstants.OPERATION: _TransactionConstants.EXECUTE_DELETE,
      _TransactionConstants.ZONE_OBJECT_TYPE_NAME: objectTypeName,
      _TransactionConstants.ZONE_OBJECT_DATA_ENTRIES: entries,
    },
  );
}