ByteArray.fromUint8List constructor

ByteArray.fromUint8List(
  1. Uint8List data
)

Creates a ByteArray from a Uint8List.

data the byte data

A wrapper for byte arrays similar to Java's byte[] with utility methods.

This class provides a convenient interface for working with byte arrays, wrapping Dart's List<int> with Java-like methods and additional utilities.

Example usage:

ByteArray bytes = ByteArray.fromString("Hello");
ByteArray copy = bytes.copy();
bytes.set(0, 72); // Change 'H' to 'H' (same value)

print(bytes.toString()); // "Hello"
print(bytes.length); // 5

Implementation

factory ByteArray.fromUint8List(Uint8List data) {
  return ByteArray._(List<int>.from(data));
}