bytes property

  1. @override
Stream<Uint8List> get bytes
override

The bytes of this stream.

Single subscription, like a ReadableStream reader. Pausing the subscription applies back-pressure to the peer.

Implementation

@override
Stream<Uint8List> get bytes {
  var controller = _controller;
  if (controller == null) {
    controller = StreamController<Uint8List>(
      onListen: _pump,
      onResume: _pump,
      onCancel: () {
        _cancelled = true;
      },
    );
    _controller = controller;
    _pump();
  } else if (_subscribed) {
    throw StateError(
      'a WebTransport receive stream is a single-subscription stream',
    );
  }
  _subscribed = true;
  return controller.stream;
}