onFlush method
Starts writing what accumulated, if not already in progress, and waits until entries accepted before this call are handed to the store (persisted or passed to onWriteError) or dropped on overflow, however many batches that takes. Does not wait for entries accepted later: otherwise, with continuous logging faster than the store writes, it would never complete.
Implementation
@override
Future<void> onFlush() async {
_startDraining();
final target = _accepted;
while (_settled < target && _draining != null) {
await _batchCompleted.future;
}
}