take method

  1. @override
void take(
  1. TakeCallback callback, [
  2. PatternMatcher? matcher
])
inherited

Used to register a taker. The take is resolved using the following rules

  • If the channel has buffered messages, then callback will be invoked with the next message from the underlying buffer (using Buffer.take)
  • If the channel is closed and there are no buffered messages, then callback is invoked with End
  • Otherwise callback will be queued until a message is put into the channel
  • If an optional pattern is provided then take will be processed only if the message matches the matcher.

Implementation

@override
void take(TakeCallback<T> callback, [PatternMatcher<T>? matcher]) {
  _channel.take(callback);
}