# ByteArray.fromString constructor

ByteArray.fromString(

1. String str

)

Creates a ByteArray from a string.

`str` the string to convert to bytes

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.fromString(String str) {
      return ByteArray._(str.codeUnits);
    }