decodeVarintAsInteger method

LayoutDecodeResult<int> decodeVarintAsInteger(
  1. int offset
)

Implementation

LayoutDecodeResult<int> decodeVarintAsInteger(int offset) {
  final decode = LayoutSerializationUtils.decodeVarint(
    _bytes,
    offset: offset,
  );
  if (!decode.value.isValidInt) {
    throw const LayoutException("varint number is too large for int.");
  }
  return LayoutDecodeResult(
    consumed: decode.consumed,
    value: decode.value.toInt(),
  );
}