decodeLengthWithDetails static method

Tuple<int, int> decodeLengthWithDetails(
  1. List<int> bytes
)

Implementation

static Tuple<int, int> decodeLengthWithDetails(List<int> bytes) {
  final decode = decodeLength(bytes, sign: false);
  if (!decode.item2.isValidInt) {
    throw const MessageException("Invalid variable length. length to large.");
  }
  final bytesLength = decode.item2.toInt();
  final dataOffset = decode.item1;
  final totalLength = bytesLength + dataOffset;
  return Tuple(dataOffset, totalLength);
}