pendingAndFailed method

List<OutboxEvent> pendingAndFailed({
  1. int limit = 100,
})

Oldest-first list of events that haven't synced yet. failed rows are surfaced too so the SyncWorker can retry them (with backoff) and the "Needs attention" UI can show them.

Implementation

List<OutboxEvent> pendingAndFailed({int limit = 100}) {
  _requireReady();
  final rs = _db!.select(
    '''
    SELECT * FROM outbox_events
     WHERE state IN ('pending','syncing','failed')
     ORDER BY created_at ASC
     LIMIT ?
  ''',
    [limit],
  );
  return rs.map(OutboxEvent.fromRow).toList(growable: false);
}