toInt property

int get toInt

Decode a big-endian integer from the buffer. Can be positive or negative.

Implementation

int get toInt {
  bool negative = length > 0 && (this[0] & 0x80) == 0x80;
  int result = 0;

  for (var i = 0; i < length; i++) {
    result = result * 256 + this[i];
  }

  return negative ? -(~result + 1) : result;
}