writeBlobAttributesTransaction method

Future<Transaction> writeBlobAttributesTransaction({
  1. required String blobObjectId,
  2. required Map<String, String?> attributes,
  3. Transaction? transaction,
})

Build a transaction that writes attributes to a blob.

If attributes already exist, their previous values will be overwritten. If an attribute value is null, it will be removed from the blob.

Mirrors the TS SDK's writeBlobAttributes().

Implementation

Future<Transaction> writeBlobAttributesTransaction({
  required String blobObjectId,
  required Map<String, String?> attributes,
  Transaction? transaction,
}) async {
  final txBuilder = await _ensureTxBuilder();
  final existingAttributes = await readBlobAttributes(
    blobObjectId: blobObjectId,
  );

  return txBuilder.writeBlobAttributesTransaction(
    blobObjectId: blobObjectId,
    attributes: attributes,
    existingAttributes: existingAttributes,
    transaction: transaction,
  );
}