ByteArray class
Simple proxy for the Uint8List type.
Designed to be used as a key in a HashMap and provide consistent equality checks by overriding the hashCode and equality== operator.
It exposes some methods from the Uint8List class, and adds additional helpers.
Constructors
- ByteArray(int length)
- Creates a Uint8List of the specified length (in elements), all of whose elements are initially zero.
-
ByteArray.fromList(List<
int> elements) - ByteArray.fromString(String string)
Properties
- bytes → Uint8List
-
Getter for the underlying value
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- isEmpty → bool
-
Checks whether the underlying collections has no elements
no setter
- length → int
-
The number of elements in the underlying value
no setter
- reversed → ByteArray
-
Reverse underlying value
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
asString(
{bool allowMalformed = false}) → String - Decode underlying Uint8List value and return String representation
-
clone(
) → ByteArray - Clone helper
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
startsWith(
ByteArray other) → bool -
Checks if the start of the underlying sequence equals to
othersequence -
sublist(
int start, [int? end]) → ByteArray -
Returns a new ByteArray with underlying Uint8List containing the elements between
startandend. -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator <(
ByteArray other) → bool -
operator ==(
Object other) → bool -
The equality operator.
override
-
operator [](
int index) → int -
operator []=(
int index, int value) → void