closeRead method

  1. @override
Future<void> closeRead()
override

Closes the stream for reading but leaves it open for writing

Implementation

@override
Future<void> closeRead() async {
  if (_isClosed) return;
  try {
    await _underlyingMuxedStream.closeRead();
    // After closing read side, we should stop our read loop.
    _muxedStreamSubscription?.cancel();
    _muxedStreamSubscription = null;
    if (!_incomingDataController.isClosed) {
       // No more data will come, so close the controller if it's not already.
      await _incomingDataController.close();
    }
  } on ResetException {
    await _handleResetOrClose();
    rethrow;
  } catch (e) {
    print('Error during closeRead: $e');
  }
  // Note: closeRead in MuxedStream doesn't free the stream.
}