flush method

  1. @override
Future<void> flush()

Completes when the queue has been fully drained.

Drain semantics: the returned future also waits for logs published after this call, until the buffer becomes empty. Completes immediately when the publisher is idle.

While a close is draining this returns that same future rather than an already-completed one — reporting "the queue is empty" while logs are still in flight would be a false all-clear at exactly the wrong moment.

Implementation

@override
Future<void> flush() {
  final closeFuture = _closeFuture;
  if (closeFuture != null) return closeFuture;

  return _flush();
}