flushWith method
Sends queued payloads through pipeline, retaining failures for retry.
Overlapping flushes in this isolate run in order. If a queued report changes while the reporter is sending it, the replacement stays queued.
Implementation
Future<void> flushWith(Reporter pipeline) => _flushes.run(() async {
final storage = await OutboxStorage.open();
await for (final record in _records(storage)) {
if (await pipeline.send(record.event)) {
await _mutations.run(
() => storage.remove(record.id, ifMatches: record.json),
);
}
}
});