stream property

Stream<Sample> get stream

Samples as the consumer sees them.

Passing through the filter is delivery — a sample still buffered in the controller has not reached anyone, which is what makes _undelivered exact. It doubles as the suppression point: closeAndDrain disposes the undelivered handles and clears the set, so any sample the closing controller still flushes is filtered out rather than handed over carrying an already-disposed handle.

Implementation

Stream<Sample> get stream => _retainPayload
    ? _controller.stream.where(_markDelivered)
    : _controller.stream;