SodiumPointer<T extends NativeType> class

A C-Pointer wrapper that uses the memory utilities of libsodium.

See https://libsodium.gitbook.io/doc/memory_management

Implemented types
Available extensions

Constructors

SodiumPointer.alloc(LibSodiumFFI sodium, {int count = 1, MemoryProtection memoryProtection = MemoryProtection.readWrite, bool zeroMemory = false})
Allocates new memory using the libsodium APIs.
factory
SodiumPointer.raw(LibSodiumFFI sodium, Pointer<T> ptr, int count)
Constructs the pointer from the libsodium API, the raw ptr and the element count.

Properties

byteLength → int
The total number of bytes this pointer is long
no setter
count → int
The number of elements this pointer is pointing to
final
elementSize → int
The number of bytes a single element of T is wide.
no setter
hashCode → int
The hash code for this object.
no setterinherited
locked ↔ bool
Controls whether the pointer is locked in memory or not.
getter/setter pair
memoryProtection ↔ MemoryProtection
Controls the memory protection level of the allocated memory
getter/setter pair
ptr → Pointer<T>
The underlying native C pointer
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sodium → LibSodiumFFI
libsodium bindings used to access the C API
final

Methods

asListView<TList extends List<num>>({bool owned = false}) → TList
Returns a dart list view on the pointer.
dispose() → void
Disposes the pointer and frees the allocated memory.
fill<TNum extends num>(List<TNum> data, {int offset = 0}) → void
Fills an area of the memory with the given data.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDartString({bool zeroTerminated = false, Encoding encoding = utf8}) → String

Available on SodiumPointer<Char>, provided by the CharSodiumPtr extension

Converts the pointer to a dart string using encoding, which defaults to utf8.
toString() → String
A string representation of this object.
inherited
viewAt(int offset, [int? length]) → SodiumPointer<T>
Returns a view of a subset of the memory the pointer is pointing to.
zeroMemory() → void
Provides sodium_memzero

Operators

operator ==(Object other) → bool
The equality operator.
inherited