compareTo method

  1. @override
int compareTo(
  1. Bytes other
)
override

Lexicographic comparison.

Implementation

@override
int compareTo(Bytes other) {
  final n = _length < other._length ? _length : other._length;
  for (var i = 0; i < n; i++) {
    final a = _buffer[_offset + i];
    final b = other._buffer[other._offset + i];
    if (a != b) return a < b ? -1 : 1;
  }
  return _length.compareTo(other._length);
}