markFailed method

void markFailed(
  1. int id,
  2. String error
)

Mark an event as failed; SyncWorker will retry with backoff next cycle. After enough attempts the row stays in failed and is surfaced in the "Needs attention" UI.

Implementation

void markFailed(int id, String error) {
  _requireReady();
  _db!.execute(
    '''
    UPDATE outbox_events
       SET state = 'failed',
           attempt_count = attempt_count + 1,
           last_attempt_at = ?,
           last_error = ?
     WHERE id = ?
    ''',
    [DateTime.now().toUtc().toIso8601String(), error, id],
  );
}