deleteAndSync method

Future<(bool, DatumSyncResult<T>)> deleteAndSync({
  1. required String id,
  2. required String userId,
  3. DatumSyncOptions<T>? syncOptions,
})

Deletes an entity locally and immediately triggers a synchronization.

This is useful for ensuring a delete operation is persisted to the remote server as soon as possible.

Returns a tuple containing a boolean indicating if the local delete was successful and the result of the subsequent synchronization.

Implementation

Future<(bool, DatumSyncResult<T>)> deleteAndSync({
  required String id,
  required String userId,
  DatumSyncOptions<T>? syncOptions,
}) async {
  _ensureInitialized();
  final wasDeleted = await delete(id: id, userId: userId);
  final syncResult = await synchronize(userId, options: syncOptions);
  return (wasDeleted, syncResult);
}