flush method
Flush all pending writes to disk.
Implementation
Future<void> flush() async {
_flushTimer?.cancel();
_flushTimer = null;
if (_activeDrain != null) {
await _activeDrain;
}
await _drainWriteQueue();
if (_pendingWriteCount > 0) {
final completer = Completer<void>();
_flushCompleters.add(completer);
return completer.future;
}
}