recv method

  1. @override
Future<Result<T, RecvError>> recv()
override

Attempts to wait for a value on this receiver, returning Err of:

DisconnectedError if the Sender called close and the buffer is empty.

OtherError if the item in the buffer is an error, indicated by the sender calling addError.

Implementation

@override
Future<Result<T, RecvError>> recv() async {
  try {
    return await _next();
  } catch (error) {
    return Err(OtherError(error));
  }
}