ReceiverDrainX<T> extension

Bulk receiving operations for Receiver.

Efficiently drain multiple values from channels with different strategies for handling timeouts and limits. Essential for batch processing.

Usage:

// Drain all immediately available
final available = rx.tryRecvAll(max: 100);

// Wait and batch with timeout
final batch = await rx.recvAll(
  idle: Duration(milliseconds: 100),
  max: 50,
);
on
  • Receiver<T>

Methods

recvAll({Duration idle = Duration.zero, int? max}) Future<Iterable<T>>

Available on Receiver<T>, provided by the ReceiverDrainX extension

Receive multiple values with batching and idle timeout.
tryRecvAll({int? max}) Iterable<T>

Available on Receiver<T>, provided by the ReceiverDrainX extension

Drain all immediately available values without waiting.