sendValue method
Send the given value to the consumer, pausing if the buffer is full. This may only be called in the producer isolate.
Implementation
Future<void> sendValue(T value) async {
_ensureInConsumer();
final session = _session!;
final size = session.bufferSize;
if (size > 1) {
await session.waitForAcks(1);
} else if (size == 1) {
// must wait until buffer is empty
await session.waitForAcks(0);
}
session.add(value);
if (size <= 0) {
// rendezvous semantics - wait until received
await session.waitForAcks(0);
}
}