StructD<D extends StructD<D, C>, C extends NativeType> class abstract

Abstract Dart-side mirror of a native struct of type C.

D is the concrete subclass (CRTP pattern), C is the corresponding NativeType. Every C struct that crosses the FFI boundary has a paired StructD subclass that owns the Dart-visible fields and knows how to read/write itself from/into native memory.

Implementers

Constructors

StructD({Pointer<C>? originalPointer})

Properties

allocKey String?
The RaylibTemp slot key used during the most recent toC allocation.
no setter
hashCode int
The hash code for this object.
no setterinherited
internalId int
A stable numeric ID assigned on first toC call for pointer-owning structs.
no setter
isDisposed bool
Whether markDisposed has been called on this instance.
no setter
originalPointer Pointer<C>?
The C-owned or RaylibTemp-owned native pointer for this struct, if any.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
structName String
The Dart-side type name of this struct
no setter
tag String
The slot tag used to disambiguate RaylibTemp keys for this instance.
no setter

Methods

allocateInto(RaylibTemp temp, Pointer<C> p, String key) → void
Writes all fields into the native struct at p, allocating nested pointers into temp under key as needed.
allocatePointer(RaylibTemp temp, String key, [int count = 1]) Pointer<C>
Allocates a native slot of count elements in temp under key and returns the resulting pointer.
clone() → D
Returns a deep copy of this instance, preserving originalPointer.
copy() → D
Returns a deep copy of this instance without originalPointer.
getOriginalPointer() Pointer<C>
Returns originalPointer, throwing a descriptive StateError if unavailable or this instance isDisposed.
getOriginalPointerAndDispose() Pointer<C>
Returns originalPointer and immediately calls markDisposed.
markDisposed() → void
Marks this instance as disposed and clears originalPointer.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onOriginalPointer(void callback(Pointer<C> p)) → void
Calls callback with originalPointer if it is set, otherwise no-ops.
setC(C o) → D
Copies the fields of the native struct o into this instance.
setD(D o) → D
Copies the fields of the Dart struct o into this instance.
setTag(String newTag) → D
Sets tag to newTag and returns this for chaining.
signature() String
Returns a human-readable description of this struct's current field values.
syncInto(RaylibTemp temp, Pointer<C> p, String key) → void
Syncs Dart-side fields into the already-allocated native pointer p.
toC(RaylibTemp temp, String key) Pointer<C>
Returns a native pointer for this struct, allocating or syncing as needed.
toString() String
A string representation of this object.
override
writeInto(C p) → void
Writes all fields directly into the native struct reference p. For nested structs, use writeInto as well.

Operators

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