ByteArray constructor
ByteArray(
- int size
Creates a ByteArray with the specified size, filled with zeros.
size
the size of the array
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(int size) {
return ByteArray._(List<int>.filled(size, 0));
}