Method DeleteFileAsync
- Namespace
- PowerSync.Common.Attachments
- Assembly
- PowerSync.Common.dll
DeleteFileAsync(string, Func<ITransaction, Attachment, Task>?)
Marks an existing attachment for deletion. The remote and local files are removed asynchronously on the next sync pass.
public Task DeleteFileAsync(string id, Func<ITransaction, Attachment, Task>? updateHook = null)
Parameters
idstringThe id of the attachment to delete.
updateHookFunc<ITransaction, Attachment, Task>Optional callback executed in the same write transaction as the state transition. Use this to atomically clear references from your data model.
Returns
- Task
A task that completes once the attachment is queued for deletion.
Remarks
Use updateHook to clear references from your data model in the same write
transaction as the state transition, so the data model and the queue stay in sync.
Exceptions
- InvalidOperationException
Thrown if no attachment with the given id exists.