tryRecv method

RecvResult<T> tryRecv()
inherited

Implementation

@pragma('vm:prefer-inline')
RecvResult<T> tryRecv() {
  if (localRecvChannel case final lc?) return lc.tryRecv();

  if (isRecvClosed) return const RecvErrorDisconnected();
  final t0 = mx.startRecvTimer();

  final v0 = buf.tryPop();
  if (v0 != null) {
    mx.tryRecvOk(t0);
    return RecvOk<T>(v0);
  }

  if (recvDisconnected) return const RecvErrorDisconnected();

  mx.tryRecvEmpty();
  return const RecvErrorEmpty();
}