toSodiumPointer method
SodiumPointer<Char>
toSodiumPointer(
- LibSodiumFFI sodium, {
- int? memoryWidth,
- bool zeroTerminated = false,
- MemoryProtection memoryProtection = MemoryProtection.readWrite,
Converts the string to a SodiumPointer<Int8>
This simply combines StringX.toCharArray with
Int8SodiumList.toSodiumPointer
.
Implementation
SodiumPointer<Char> toSodiumPointer(
LibSodiumFFI sodium, {
int? memoryWidth,
bool zeroTerminated = false,
MemoryProtection memoryProtection = MemoryProtection.readWrite,
}) {
late final SodiumPointer<Char> ptr;
toCharArray(
memoryWidth: memoryWidth,
zeroTerminated: zeroTerminated,
allocator: (length) =>
(ptr = SodiumPointer.alloc(sodium, count: length)).asListView(),
);
ptr.memoryProtection = memoryProtection;
return ptr;
}