ByteSelection class

Represents a selection of bytes in the hex viewer.

This class describes a range of selected bytes with inclusive start and end offsets. It provides utilities for querying selection properties and extracting selected bytes.

Example:

// Single byte selection
final selection = ByteSelection.single(10);
print(selection.length); // 1

// Range selection
final range = ByteSelection.range(5, 15);
print(range.length); // 11 bytes (5-15 inclusive)
print(range.contains(10)); // true

// Get selected bytes
final bytes = range.getBytes(myData);

See also:

Constructors

ByteSelection({required int startOffset, required int endOffset})
Creates a byte selection with the given offsets.
const
ByteSelection.range(int start, int end)
Creates a selection from a range of bytes.
factory
ByteSelection.single(int offset)
Creates a selection of a single byte at the given offset.
factory

Properties

end → int
Convenience getter for end offset.
no setter
endOffset → int
End offset of the selection (inclusive).
final
hashCode → int
The hash code for this object.
no setteroverride
length → int
Number of bytes in the selection.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
start → int
Convenience getter for start offset.
no setter
startOffset → int
Start offset of the selection (inclusive).
final

Methods

contains(int offset) → bool
Checks if the given offset is within this selection.
getBytes(List<int> data) → List<int>
Extracts the selected bytes from the given data.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override