shutdown method
Implementation
Future<void> shutdown() async {
if (_shutdown) return;
_shutdown = true;
try {
await _subscription?.cancel();
} catch (_) {}
_subscription = null;
try {
await _controller?.close();
} catch (_) {}
_controller = null;
}