indexOf method

int indexOf (
  1. int value,
  2. [int offset = 0]
)

Returns the position of the given value within the buffer, starting from the current read position with the given offset. The position returned is relative to the start of the buffer, or -1 if the value was not found.

Implementation

int indexOf(int value, [int offset = 0]) {
  for (var i = this.offset + offset, end = this.offset + length;
      i < end; ++i) {
    if (buffer[i] == value) {
      return i - start;
    }
  }
  return -1;
}