StructPointer<D extends RaylibStruct<D>> class final

A MemoryPointer<RStruct> that also knows its element type D, so it can offer .value/[]/[]= the similar way scalar RType extensions do.

Inheritance
Available extensions

Constructors

StructPointer(MemoryPointer<RType> ptr, StructType<D> structType)
StructPointer.nullable(MemoryPointer<RType>? ptr, StructType<D> structType)
factory

Properties

address → int
Debug/logging only. Do NOT branch logic on this.
no setteroverride
allocationKey → String?
The key of the temporary allocation backing this pointer.
no setteroverride
detached → D
Returns a copy of the struct's current value, detached from its underlying memory.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hex → String
address in hexadecimal format.
no setteroverride
isFreed ↔ bool
If the underlying allocation has been freed.
getter/setter pairinherited
isNull → bool
Check if the pointer is a nullptr.
no setteroverride
ptr → MemoryPointer<RType>
final
ref ↔ D
Returns a live view of the struct backed by this memory.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
structType → StructType<D>
final
toJS → JSNumber

Available on StructPointer<RaylibStruct>, provided by the StructPointerAsWasmPointer extension

no setter
value → D
Returns the current value of the struct.
no setter

Methods

asCopy<T extends TypedDataList>(int length) → T
Copies length bytes, viewed as T.
override
asView<T extends TypedDataList>(int length) → T
Zero-copy view as T.
override
cast<Y extends RType>() → MemoryPointer<Y>
Reinterprets this pointer as pointing to Y instead of X.
override
compareBytes(MemoryPointer<RType> other, int length, {int offset = 0, int otherOffset = 0}) → int
memcmp-style comparison of length bytes.
override
computeByteHash(int byteSize) → int
Hashes the bytes until byteSize.
override
copyBytesFrom(MemoryPointer<RType> src, int length, {int destOffset = 0, int srcOffset = 0}) → void
Bulk-copies length bytes from src into this pointer.
override
fillBytes(int value, int length, [int byteOffset = 0]) → void
Fills length bytes starting at byteOffset with the low byte of value.
override
free() → void
Frees the underlying allocation. Only call this if you actually own it.
override
live({List<D>? initial, bool owned = true}) → StructLiveList<D, RStruct>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
offsetBy<Y extends RType>(int byteOffset) → MemoryPointer<Y>
Same buffer, address advanced by byteOffset bytes. Same type X. Backends implement via pointer arithmetic (native) or address+offset (wasm).
override
owned(int i) → D
Returns the struct at i as a memory-backed value.
readArray(int count, {bool owned = true}) → List<D>
Reads count structs sequentially from the memory referenced by this pointer.
readBool([int byteOffset = 0]) → bool
Reads a value of type RBool at given address + byteOffset.
override
readBytes(int byteOffset, int length) → Uint8List
Reads length bytes at byteOffset.
override
readChar([int byteOffset = 0]) → int
Reads a value of type RChar at given address + byteOffset.
override
readDouble([int byteOffset = 0]) → double
Reads a value of type RDouble at given address + byteOffset.
override
readFloat([int byteOffset = 0]) → double
Reads a value of type RFloat at given address + byteOffset.
override
readFloat32([int byteOffset = 0]) → double
Reads a value of type RFloat32 at given address + byteOffset.
override
readFloat64([int byteOffset = 0]) → double
Reads a value of type RFloat64 at given address + byteOffset.
override
readInt([int byteOffset = 0]) → int
Reads a value of type RInt at given address + byteOffset.
override
readInt16([int byteOffset = 0]) → int
Reads a value of type RInt16 at given address + byteOffset.
override
readInt32([int byteOffset = 0]) → int
Reads a value of type RInt32 at given address + byteOffset.
override
readInt64([int byteOffset = 0]) → int
Reads a value of type RInt64 at given address + byteOffset.
override
readInt8([int byteOffset = 0]) → int
Reads a value of type RInt8 at given address + byteOffset.
override
readPtr<Y extends RType>([int byteOffset = 0]) → MemoryPointer<Y>
Reads a pointer value at address + byteOffset and returns it typed as pointing to Y.
override
readShort([int byteOffset = 0]) → int
Reads a value of type RShort at given address + byteOffset.
override
readSize([int byteOffset = 0]) → int
Reads a value of type RSize at given address + byteOffset.
override
readStringUTF16([int? maxLength, int byteOffset = 0]) → String
Reads a fixed-size char-buffer field as a UTF-16 string, stopping early at NUL if present.
override
readStringUTF32([int? maxLength, int byteOffset = 0]) → String
Reads a fixed-size char-buffer field as a UTF-32 string, stopping early at NUL if present.
override
readStringUTF8([int? maxLength, int byteOffset = 0]) → String
Reads a fixed-size char-buffer field as a UTF-8 string, stopping early at NUL if present.
override
readUint16([int byteOffset = 0]) → int
Reads a value of type RUint16 at given address + byteOffset.
override
readUint32([int byteOffset = 0]) → int
Reads a value of type RUint32 at given address + byteOffset.
override
readUint64([int byteOffset = 0]) → int
Reads a value of type RUint64 at given address + byteOffset.
override
readUint8([int byteOffset = 0]) → int
Reads a value of type RUint8 at given address + byteOffset.
override
readUnsignedChar([int byteOffset = 0]) → int
Reads a value of type RUnsignedChar at given address + byteOffset.
override
readUnsignedInt([int byteOffset = 0]) → int
Reads a value of type RUnsignedInt at given address + byteOffset.
override
readUnsignedShort([int byteOffset = 0]) → int
Reads a value of type RUnsignedShort at given address + byteOffset.
override
toString() → String
A string representation of this object.
inherited
writeArray(List<D> items) → void
Writes items sequentially into the memory referenced by this pointer.
writeBool(bool value, [int byteOffset = 0]) → void
Writes a value of type RBool at given address + byteOffset.
override
writeChar(int value, [int byteOffset = 0]) → void
Writes a value of type RChar at given address + byteOffset.
override
writeDouble(double value, [int byteOffset = 0]) → void
Writes a value of type RDouble at given address + byteOffset.
override
writeFloat(double value, [int byteOffset = 0]) → void
Writes a value of type RFloat at given address + byteOffset.
override
writeFloat32(double value, [int byteOffset = 0]) → void
Writes a value of type RFloat32 at given address + byteOffset.
override
writeFloat64(double value, [int byteOffset = 0]) → void
Writes a value of type RFloat64 at given address + byteOffset.
override
writeInt(int value, [int byteOffset = 0]) → void
Writes a value of type RInt at given address + byteOffset.
override
writeInt16(int value, [int byteOffset = 0]) → void
Writes a value of type RInt16 at given address + byteOffset.
override
writeInt32(int value, [int byteOffset = 0]) → void
Writes a value of type RInt32 at given address + byteOffset.
override
writeInt64(int value, [int byteOffset = 0]) → void
Writes a value of type RInt64 at given address + byteOffset.
override
writeInt8(int value, [int byteOffset = 0]) → void
Writes a value of type RInt8 at given address + byteOffset.
override
writePtr(MemoryPointer<RType>? value, [int byteOffset = 0]) → void
Writes a pointer at given address + byteOffset.
override
writeShort(int value, [int byteOffset = 0]) → void
Writes a value of type RShort at given address + byteOffset.
override
writeSize(int value, [int byteOffset = 0]) → void
Writes a value of type RSize at given address + byteOffset.
override
writeStringUTF16(String text, [int? maxLength, int byteOffset = 0]) → void
Writes a UTF-16 text into a fixed-size maxLength-byte buffer field at address + byteOffset. Truncates if too long; otherwise NUL-terminates and zero-pads the remainder.
override
writeStringUTF32(String text, [int? maxLength, int byteOffset = 0]) → void
Writes a UTF-32 text into a fixed-size maxLength-byte buffer field at address + byteOffset. Truncates if too long; otherwise NUL-terminates and zero-pads the remainder.
override
writeStringUTF8(String text, [int? maxLength, int byteOffset = 0]) → void
Writes a UTF-8 text into a fixed-size maxLength-byte buffer field at address + byteOffset. Truncates if too long; otherwise NUL-terminates and zero-pads the remainder.
override
writeUint16(int value, [int byteOffset = 0]) → void
Writes a value of type RUint16 at given address + byteOffset.
override
writeUint32(int value, [int byteOffset = 0]) → void
Writes a value of type RUint32 at given address + byteOffset.
override
writeUint64(int value, [int byteOffset = 0]) → void
Writes a value of type RUint64 at given address + byteOffset.
override
writeUint8(int value, [int byteOffset = 0]) → void
Writes a value of type RUint8 at given address + byteOffset.
override
writeUnsignedChar(int value, [int byteOffset = 0]) → void
Writes a value of type RUnsignedChar at given address + byteOffset.
override
writeUnsignedInt(int value, [int byteOffset = 0]) → void
Writes a value of type RUnsignedInt at given address + byteOffset.
override
writeUnsignedShort(int value, [int byteOffset = 0]) → void
Writes a value of type RUnsignedShort at given address + byteOffset.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited
operator [](int i) → D
Returns a detached copy of the struct at i.
operator []=(int i, D v) → void
Writes the current field values of v into the struct at i.