closeStream method
Close the stream connection and release resources.
Implementation
Future<void> closeStream() async {
if (!_streamController.hasListener) {
_internalListener.pause();
await _close(name);
_stream = null;
if (!_streamController.isClosed) _streamController.add(null);
}
}