contains method

bool contains(
  1. int offset
)

Checks if the given offset is within this selection.

Returns true if offset is between startOffset and endOffset (inclusive).

Example:

final sel = ByteSelection.range(5, 10);
sel.contains(7);  // true
sel.contains(5);  // true (inclusive)
sel.contains(10); // true (inclusive)
sel.contains(11); // false

Implementation

bool contains(int offset) {
  return offset >= startOffset && offset <= endOffset;
}