stop method
Stop listening, write what is batched and close the file; the sink is no longer current. Safe to call twice.
Implementation
Future<void> stop() async {
if (_stopped) return;
_stopped = true;
if (identical(_current, this)) _current = null;
for (final StreamSubscription<Object> subscription in _subscriptions) {
await subscription.cancel();
}
await flush();
await _serial(() async {
await _open?.close();
_open = null;
});
}