BinaryLengthValue.fromString constructor

BinaryLengthValue.fromString(
  1. String value, {
  2. Encoding encoding = utf8,
})

Create a length plus bytes for a string.

The string is encoded using the encoding, which defaults to utf8. This default works for US-ASCII too if the value can be guaranteed to only contain US-ASCII characters, since US-ASCII is a subset of utf8.

Implementation

BinaryLengthValue.fromString(String value, {Encoding encoding = utf8})
    : _dataBytes = Uint8List.fromList(encoding.encode(value));