BytesUtils class

A utility class for working with binary data represented as lists of integers (bytes).

Constructors

BytesUtils()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

bytesEqual(List<int>? a, List<int>? b) bool
Compare two lists of bytes for equality. This function compares two lists of bytes 'a' and 'b' for equality. It returns true if the lists are equal (including null check), false if they have different lengths or contain different byte values, and true if the lists reference the same object.
compareBytes(List<int> a, List<int> b) int
Compare two Uint8Lists lexicographically.
fromBinary(String data, {int zeroPadByteLen = 0}) List<int>
Converts a binary string to a list of bytes.
fromHexString(String data, {bool paddingZero = false}) List<int>
Converts a hexadecimal string data into a List of integers representing bytes.
isContains(List<List<int>> a, List<int> part) bool
isLessThanBytes(List<int> thashedA, List<int> thashedB) bool
toBinary(List<int> dataBytes, {int zeroPadBitLen = 0}) String
Converts a list of bytes to a binary string representation.
toBytes(Iterable<int> bytes, {bool unmodifiable = false}) List<int>
Ensures that each byte is properly represented as an 8-bit integer.
toHexString(List<int> dataBytes, {bool lowerCase = true, String? prefix}) String
Converts a List of integers representing bytes, dataBytes, into a hexadecimal string.
tryFromHexString(String? data) List<int>?
Tries to convert a hexadecimal string data into a List of integers.
tryToBytes(List<int>? bytes, {bool unmodifiable = false}) List<int>?
tryToHexString(List<int>? dataBytes, {bool lowerCase = true, String? prefix}) String?
Tries to convert a list of integers representing bytes, dataBytes, into a hexadecimal string.
validateBytes(Iterable<int> bytes, {String? onError}) → void
Validates a list of integers representing bytes.
xor(List<int> dataBytes1, List<int> dataBytes2) List<int>
Performs a bitwise XOR operation on two lists of bytes.