rangeEquals method
Whether bytes in a range of this byte data equal corresponding bytes in
other.
Compares bytes of this byte data from byte offset start (inclusive) to
end (exclusive) with bytes of other starting at byte offset
otherStart.
Returns whether all corresponding pairs of bytes are equal.
An empty range (start == end) returns true.
The ranges must satisfy 0 ≤ start ≤ end ≤ lengthInBytes and
0 ≤ otherStart with otherStart + (end - start) ≤ other.lengthInBytes.
Implementation
@pragma('vm:prefer-inline')
@pragma('wasm:prefer-inline')
@pragma('dart2js:prefer-inline')
bool rangeEquals(int start, int end, ByteData other, [int otherStart = 0]) {
final count = _rangeEqualsBoundsCheck(
lengthInBytes,
start,
end,
other.lengthInBytes,
otherStart,
);
if (count == 0) return true;
if (identical(this, other) && start == otherStart) return true;
return _byteDataRangeEquals(this, start, other, otherStart, count);
}