setValue method
Sets the value of the string.
Encodes the given string to UTF-8 and stores it in the allocated memory.
@param value The string value to set. @throws ArgumentError if the string is too long for the capacity.
Implementation
void setValue(String value) {
final bytes = utf8.encode(value);
if (bytes.length > capacity) {
throw ArgumentError('String too long for capacity');
}
final list = data.asTypedList(capacity);
list.fillRange(0, capacity, 0);
list.setAll(0, bytes);
length = bytes.length;
}