scheduleDelete method

void scheduleDelete(
  1. String id
)

Schedule a deletion for the given entity id. This will take precedence over any pending patches for the same id and will be persisted in outbox.

Implementation

void scheduleDelete(String id) {
  // Mark delete and clear any pending patch
  _pendingDeleteIds.add(id);
  _pendingPatchById[id] = <String, dynamic>{};
  _patchIdById[id] ??= _generatePatchId();

  _debouncers[id]?.cancel();
  _debouncers[id] = Timer(debounceDelay, () => _flushDelete(id));

  _ensureHeartbeat();
  unawaited(_persistOutbox());
}