ByteSelection.range constructor
Creates a selection from a range of bytes.
Automatically orders the offsets so startOffset ≤ endOffset,
regardless of the order of start and end parameters.
Example:
// Both create the same selection (5-10):
final sel1 = ByteSelection.range(5, 10);
final sel2 = ByteSelection.range(10, 5);
print(sel1 == sel2); // true
Implementation
factory ByteSelection.range(int start, int end) {
final actualStart = start < end ? start : end;
final actualEnd = start < end ? end : start;
return ByteSelection(startOffset: actualStart, endOffset: actualEnd);
}