flush method
Hand every batched line to disk; completes once they are written.
Throws a FileSystemException when the write fails.
Implementation
Future<void> flush() {
_timer?.cancel();
_timer = null;
if (_pending.isEmpty) return _serial(() async {});
final List<String> batch = List<String>.of(_pending);
_pending.clear();
return _serial(() => _write(batch));
}