copyString method
SodiumPointer<Char>
copyString(
- String str, {
- int? memoryWidth,
- bool zeroTerminated = false,
- MemoryProtection memoryProtection = .readOnly,
- Encoding encoding = utf8,
Copies str into a fresh, tracked SodiumPointer of Char.
Covers kdf/aead contexts, passwords and encoded hashes. memoryWidth pads
the buffer to a fixed size (e.g. a kdf context) and throws an
ArgumentError if str does not fit; zeroTerminated stops the encoding
at the first NUL and drops the rest of str; encoding selects the
encoding and defaults to utf8. Defaults to
MemoryProtection.readOnly. Wraps SodiumString.toSodiumPointer.
Implementation
SodiumPointer<Char> copyString(
String str, {
int? memoryWidth,
bool zeroTerminated = false,
MemoryProtection memoryProtection = .readOnly,
Encoding encoding = utf8,
}) => _track(
str.toSodiumPointer(
_sodium,
memoryWidth: memoryWidth,
zeroTerminated: zeroTerminated,
memoryProtection: memoryProtection,
encoding: encoding,
),
);