MemoryPointer<X extends RType> class
abstract
Backend-agnostic handle to a raw memory buffer returned by a C function.
- Implementers
- Available extensions
Constructors
Properties
- address → int
-
Debug/logging only. Do NOT branch logic on this.
no setter
- allocationKey → String?
-
The key of the temporary allocation backing this pointer.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- hex → String
-
address in hexadecimal format.
no setter
- isFreed ↔ bool
-
If the underlying allocation has been freed.
getter/setter pair
- isNull → bool
-
Check if the pointer is a
nullptr.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value ↔ bool
-
Available on MemoryPointer<
RBool> , provided by the BoolPointer extensiongetter/setter pair - value ↔ double
-
Available on MemoryPointer<
RFloat32> , provided by the Float32Pointer extensiongetter/setter pair - value ↔ double
-
Available on MemoryPointer<
RFloat64> , provided by the Float64Pointer extensiongetter/setter pair - value ↔ int
-
Available on MemoryPointer<
RInt8> , provided by the Int8Pointer extensiongetter/setter pair - value ↔ int
-
Available on MemoryPointer<
RInt16> , provided by the Int16Pointer extensiongetter/setter pair - value ↔ int
-
Available on MemoryPointer<
RInt32> , provided by the Int32Pointer extensiongetter/setter pair - value ↔ int
-
Available on MemoryPointer<
RInt64> , provided by the Int64Pointer extensiongetter/setter pair - value ↔ int
-
Available on MemoryPointer<
RSize> , provided by the SizePointer extensiongetter/setter pair - value ↔ int
-
Available on MemoryPointer<
RUint8> , provided by the Uint8Pointer extensiongetter/setter pair - value ↔ int
-
Available on MemoryPointer<
RUint16> , provided by the Uint16Pointer extensiongetter/setter pair - value ↔ int
-
Available on MemoryPointer<
RUint32> , provided by the Uint32Pointer extensiongetter/setter pair - value ↔ int
-
Available on MemoryPointer<
RUint64> , provided by the Uint64Pointer extensiongetter/setter pair
Methods
-
asCopy<
T extends TypedDataList> (int length) → T -
Copies
lengthbytes, viewed asT. -
asView<
T extends TypedDataList> (int length) → T -
Zero-copy view as
T. -
cast<
Y extends RType> () → MemoryPointer< Y> -
Reinterprets this pointer as pointing to
Yinstead ofX. -
compareBytes(
MemoryPointer< RType> other, int length, {int offset = 0, int otherOffset = 0}) → int -
memcmp-style comparison of
lengthbytes. -
computeByteHash(
int byteSize) → int -
Hashes the bytes until
byteSize. -
copyBytesFrom(
MemoryPointer< RType> src, int length, {int destOffset = 0, int srcOffset = 0}) → void -
Bulk-copies
lengthbytes fromsrcinto this pointer. -
fillBytes(
int value, int length, [int byteOffset = 0]) → void -
Fills
lengthbytes starting atbyteOffsetwith the low byte ofvalue. -
free(
) → void - Frees the underlying allocation. Only call this if you actually own it.
-
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
byteOffsetbytes. Same typeX. Backends implement via pointer arithmetic (native) or address+offset (wasm). -
readArray(
int count) → List< int> -
Available on MemoryPointer<
RSize> , provided by the SizePointer extension -
readArray(
int count) → List< int> -
Available on MemoryPointer<
RUint8> , provided by the Uint8Pointer extension -
readArray(
int count) → List< bool> -
Available on MemoryPointer<
RBool> , provided by the BoolPointer extension -
readArray(
int count) → List< double> -
Available on MemoryPointer<
RFloat64> , provided by the Float64Pointer extension -
readArray(
int count) → List< double> -
Available on MemoryPointer<
RFloat32> , provided by the Float32Pointer extension -
readArray(
int count) → List< int> -
Available on MemoryPointer<
RInt16> , provided by the Int16Pointer extension -
readArray(
int count) → List< int> -
Available on MemoryPointer<
RInt8> , provided by the Int8Pointer extension -
readArray(
int count) → List< int> -
Available on MemoryPointer<
RInt32> , provided by the Int32Pointer extension -
readArray(
int count) → List< int> -
Available on MemoryPointer<
RInt64> , provided by the Int64Pointer extension -
readArray(
int count) → List< int> -
Available on MemoryPointer<
RUint64> , provided by the Uint64Pointer extension -
readArray(
int count) → List< int> -
Available on MemoryPointer<
RUint32> , provided by the Uint32Pointer extension -
readArray(
int count) → List< int> -
Available on MemoryPointer<
RUint16> , provided by the Uint16Pointer extension -
readBool(
[int byteOffset = 0]) → bool -
Reads a value of type RBool at given
address + byteOffset. -
readBytes(
int byteOffset, int length) → Uint8List -
Reads
lengthbytes atbyteOffset. -
readChar(
[int byteOffset = 0]) → int -
Reads a value of type RChar at given
address + byteOffset. -
readDouble(
[int byteOffset = 0]) → double -
Reads a value of type RDouble at given
address + byteOffset. -
readFloat(
[int byteOffset = 0]) → double -
Reads a value of type RFloat at given
address + byteOffset. -
readFloat32(
[int byteOffset = 0]) → double -
Reads a value of type RFloat32 at given
address + byteOffset. -
readFloat64(
[int byteOffset = 0]) → double -
Reads a value of type RFloat64 at given
address + byteOffset. -
readInt(
[int byteOffset = 0]) → int -
Reads a value of type RInt at given
address + byteOffset. -
readInt16(
[int byteOffset = 0]) → int -
Reads a value of type RInt16 at given
address + byteOffset. -
readInt32(
[int byteOffset = 0]) → int -
Reads a value of type RInt32 at given
address + byteOffset. -
readInt64(
[int byteOffset = 0]) → int -
Reads a value of type RInt64 at given
address + byteOffset. -
readInt8(
[int byteOffset = 0]) → int -
Reads a value of type RInt8 at given
address + byteOffset. -
readMatrix<
D extends RaylibStruct< (D> >int rowCount, int rowLength, StructPointer< D> factory(MemoryPointer<RType> ptr), {bool owned = false}) → List<List< D> > -
Available on MemoryPointer<
RPointer< , provided by the MemoryPointerMatrixIO extensionRStruct> > -
readPtr<
Y extends RType> ([int byteOffset = 0]) → MemoryPointer< Y> -
Reads a pointer value at
address + byteOffsetand returns it typed as pointing toY. -
readPtrArray<
X extends RType> (int count) → List< MemoryPointer< X> > -
Available on MemoryPointer<
ReadsRPointer< , provided by the PointerArrayOnPointer extensionRType> >countpointers from this pointer array. -
readShort(
[int byteOffset = 0]) → int -
Reads a value of type RShort at given
address + byteOffset. -
readSize(
[int byteOffset = 0]) → int -
Reads a value of type RSize at given
address + byteOffset. -
readStringArray(
int count) → List< String> -
Available on MemoryPointer<
ReadsRPointer< , provided by the MemoryPointerStringIO extensionRChar> >countC strings from achar**-style pointer (this pointer points at an array of char* pointers, each read and decoded). -
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.
-
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.
-
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.
-
readUint16(
[int byteOffset = 0]) → int -
Reads a value of type RUint16 at given
address + byteOffset. -
readUint32(
[int byteOffset = 0]) → int -
Reads a value of type RUint32 at given
address + byteOffset. -
readUint64(
[int byteOffset = 0]) → int -
Reads a value of type RUint64 at given
address + byteOffset. -
readUint8(
[int byteOffset = 0]) → int -
Reads a value of type RUint8 at given
address + byteOffset. -
readUnsignedChar(
[int byteOffset = 0]) → int -
Reads a value of type RUnsignedChar at given
address + byteOffset. -
readUnsignedInt(
[int byteOffset = 0]) → int -
Reads a value of type RUnsignedInt at given
address + byteOffset. -
readUnsignedShort(
[int byteOffset = 0]) → int -
Reads a value of type RUnsignedShort at given
address + byteOffset. -
toDartString(
[int? maxLength]) → String -
Available on MemoryPointer<
RInt32> , provided by the Utf32StringPointer extension -
toDartString(
[int? maxLength]) → String -
Available on MemoryPointer<
RInt16> , provided by the Utf16StringPointer extension -
toDartString(
[int? maxLength]) → String -
Available on MemoryPointer<
Reads a NUL-terminated C string starting at this pointer, decoded as UTF-8. Scans for the NUL byte itself, no length needed.RInt8> , provided by the Utf8StringPointer extension -
toString(
) → String -
A string representation of this object.
inherited
-
writeArray(
List< int> values) → void -
Available on MemoryPointer<
RUint8> , provided by the Uint8Pointer extension -
writeArray(
List< int> values) → void -
Available on MemoryPointer<
RUint32> , provided by the Uint32Pointer extension -
writeArray(
List< int> values) → void -
Available on MemoryPointer<
RUint64> , provided by the Uint64Pointer extension -
writeArray(
List< bool> values) → void -
Available on MemoryPointer<
RBool> , provided by the BoolPointer extension -
writeArray(
List< double> values) → void -
Available on MemoryPointer<
RFloat32> , provided by the Float32Pointer extension -
writeArray(
List< double> values) → void -
Available on MemoryPointer<
RFloat64> , provided by the Float64Pointer extension -
writeArray(
List< int> values) → void -
Available on MemoryPointer<
RInt8> , provided by the Int8Pointer extension -
writeArray(
List< int> values) → void -
Available on MemoryPointer<
RInt16> , provided by the Int16Pointer extension -
writeArray(
List< int> values) → void -
Available on MemoryPointer<
RInt32> , provided by the Int32Pointer extension -
writeArray(
List< int> values) → void -
Available on MemoryPointer<
RUint16> , provided by the Uint16Pointer extension -
writeArray(
List< int> values) → void -
Available on MemoryPointer<
RInt64> , provided by the Int64Pointer extension -
writeArray(
List< int> values) → void -
Available on MemoryPointer<
RSize> , provided by the SizePointer extension -
writeBool(
bool value, [int byteOffset = 0]) → void -
Writes a
valueof type RBool at givenaddress + byteOffset. -
writeChar(
int value, [int byteOffset = 0]) → void -
Writes a
valueof type RChar at givenaddress + byteOffset. -
writeDouble(
double value, [int byteOffset = 0]) → void -
Writes a
valueof type RDouble at givenaddress + byteOffset. -
writeFloat(
double value, [int byteOffset = 0]) → void -
Writes a
valueof type RFloat at givenaddress + byteOffset. -
writeFloat32(
double value, [int byteOffset = 0]) → void -
Writes a
valueof type RFloat32 at givenaddress + byteOffset. -
writeFloat64(
double value, [int byteOffset = 0]) → void -
Writes a
valueof type RFloat64 at givenaddress + byteOffset. -
writeInt(
int value, [int byteOffset = 0]) → void -
Writes a
valueof type RInt at givenaddress + byteOffset. -
writeInt16(
int value, [int byteOffset = 0]) → void -
Writes a
valueof type RInt16 at givenaddress + byteOffset. -
writeInt32(
int value, [int byteOffset = 0]) → void -
Writes a
valueof type RInt32 at givenaddress + byteOffset. -
writeInt64(
int value, [int byteOffset = 0]) → void -
Writes a
valueof type RInt64 at givenaddress + byteOffset. -
writeInt8(
int value, [int byteOffset = 0]) → void -
Writes a
valueof type RInt8 at givenaddress + byteOffset. -
writeMatrix<
D extends RaylibStruct< (D> >List< StructLiveList< rows) → voidD, RStruct> > -
Available on MemoryPointer<
RPointer< , provided by the MemoryPointerMatrixIO extensionRStruct> > -
writePtr(
MemoryPointer< RType> ? value, [int byteOffset = 0]) → void -
Writes a pointer at given
address + byteOffset. -
writeShort(
int value, [int byteOffset = 0]) → void -
Writes a
valueof type RShort at givenaddress + byteOffset. -
writeSize(
int value, [int byteOffset = 0]) → void -
Writes a
valueof type RSize at givenaddress + byteOffset. -
writeString(
String text, [int? maxLength, int elementOffset = 0]) → void -
Available on MemoryPointer<
WritesRInt16> , provided by the Utf16StringPointer extensiontextinto a buffer field ataddress + elementOffset*2. IfmaxLengthis null, it's derived from the UTF-16 code unit length oftext(caller is responsible for the field actually being that size). -
writeString(
String text, [int? maxLength, int byteOffset = 0]) → void -
Available on MemoryPointer<
WritesRInt8> , provided by the Utf8StringPointer extensiontextinto a buffer field ataddress + byteOffset. IfmaxLengthis null, it's derived from the UTF-8 byte length oftext(caller is responsible for the field actually being that size). Truncates iftextexceedsmaxLength; otherwise NUL-terminates and zero-pads the remainder. -
writeString(
String text, [int? maxLength, int elementOffset = 0]) → void -
Available on MemoryPointer<
WritesRInt32> , provided by the Utf32StringPointer extensiontextinto a buffer field ataddress + elementOffset*4. IfmaxLengthis null, it's derived from the UTF-32 code unit (rune) length oftext(caller is responsible for the field actually being that size). -
writeStringArray(
List< String> strings, [List<int> ? slotSizes]) → void -
Available on MemoryPointer<
WritesRPointer< , provided by the MemoryPointerStringIO extensionRChar> >stringsinto this pre-allocated char**-sized buffer. Both the outer array (strings.length pointer slots) and each inner char* target buffer must already exist. [slotSizesi] is the real allocated byte capacity of slot i's buffer (bytes available, terminator included), if not provided, string's length is used instead. -
writeStringUTF16(
String text, [int? maxLength, int byteOffset = 0]) → void -
Writes a UTF-16
textinto a fixed-sizemaxLength-byte buffer field ataddress + byteOffset. Truncates if too long; otherwise NUL-terminates and zero-pads the remainder. -
writeStringUTF32(
String text, [int? maxLength, int byteOffset = 0]) → void -
Writes a UTF-32
textinto a fixed-sizemaxLength-byte buffer field ataddress + byteOffset. Truncates if too long; otherwise NUL-terminates and zero-pads the remainder. -
writeStringUTF8(
String text, [int? maxLength, int byteOffset = 0]) → void -
Writes a UTF-8
textinto a fixed-sizemaxLength-byte buffer field ataddress + byteOffset. Truncates if too long; otherwise NUL-terminates and zero-pads the remainder. -
writeUint16(
int value, [int byteOffset = 0]) → void -
Writes a
valueof type RUint16 at givenaddress + byteOffset. -
writeUint32(
int value, [int byteOffset = 0]) → void -
Writes a
valueof type RUint32 at givenaddress + byteOffset. -
writeUint64(
int value, [int byteOffset = 0]) → void -
Writes a
valueof type RUint64 at givenaddress + byteOffset. -
writeUint8(
int value, [int byteOffset = 0]) → void -
Writes a
valueof type RUint8 at givenaddress + byteOffset. -
writeUnsignedChar(
int value, [int byteOffset = 0]) → void -
Writes a
valueof type RUnsignedChar at givenaddress + byteOffset. -
writeUnsignedInt(
int value, [int byteOffset = 0]) → void -
Writes a
valueof type RUnsignedInt at givenaddress + byteOffset. -
writeUnsignedShort(
int value, [int byteOffset = 0]) → void -
Writes a
valueof type RUnsignedShort at givenaddress + byteOffset.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
-
operator [](
int i) → bool -
Available on MemoryPointer<
RBool> , provided by the BoolPointer extension -
operator [](
int i) → double -
Available on MemoryPointer<
RFloat32> , provided by the Float32Pointer extension -
operator [](
int i) → double -
Available on MemoryPointer<
RFloat64> , provided by the Float64Pointer extension -
operator [](
int i) → int -
Available on MemoryPointer<
RInt8> , provided by the Int8Pointer extension -
operator [](
int i) → int -
Available on MemoryPointer<
RInt16> , provided by the Int16Pointer extension -
operator [](
int i) → int -
Available on MemoryPointer<
RInt32> , provided by the Int32Pointer extension -
operator [](
int i) → int -
Available on MemoryPointer<
RInt64> , provided by the Int64Pointer extension -
operator [](
int i) → int -
Available on MemoryPointer<
RSize> , provided by the SizePointer extension -
operator [](
int i) → int -
Available on MemoryPointer<
RUint8> , provided by the Uint8Pointer extension -
operator [](
int i) → int -
Available on MemoryPointer<
RUint16> , provided by the Uint16Pointer extension -
operator [](
int i) → int -
Available on MemoryPointer<
RUint32> , provided by the Uint32Pointer extension -
operator [](
int i) → int -
Available on MemoryPointer<
RUint64> , provided by the Uint64Pointer extension -
operator []=(
int i, bool v) → void -
Available on MemoryPointer<
RBool> , provided by the BoolPointer extension -
operator []=(
int i, double v) → void -
Available on MemoryPointer<
RFloat32> , provided by the Float32Pointer extension -
operator []=(
int i, double v) → void -
Available on MemoryPointer<
RFloat64> , provided by the Float64Pointer extension -
operator []=(
int i, int v) → void -
Available on MemoryPointer<
RInt8> , provided by the Int8Pointer extension -
operator []=(
int i, int v) → void -
Available on MemoryPointer<
RInt16> , provided by the Int16Pointer extension -
operator []=(
int i, int v) → void -
Available on MemoryPointer<
RInt32> , provided by the Int32Pointer extension -
operator []=(
int i, int v) → void -
Available on MemoryPointer<
RInt64> , provided by the Int64Pointer extension -
operator []=(
int i, int v) → void -
Available on MemoryPointer<
RSize> , provided by the SizePointer extension -
operator []=(
int i, int v) → void -
Available on MemoryPointer<
RUint8> , provided by the Uint8Pointer extension -
operator []=(
int i, int v) → void -
Available on MemoryPointer<
RUint16> , provided by the Uint16Pointer extension -
operator []=(
int i, int v) → void -
Available on MemoryPointer<
RUint32> , provided by the Uint32Pointer extension -
operator []=(
int i, int v) → void -
Available on MemoryPointer<
RUint64> , provided by the Uint64Pointer extension
Static Properties
-
calloc
↔ MemoryPointer<
Y> Function<Y extends RType>(int nmemb, int size) -
Allocates a memory of given
nmemb * sizeand zero initializes it.getter/setter pair - debug ↔ bool
-
Provides more information on double-frees or reads/writes on an invalid pointer.
getter/setter pair
-
fromAddress
↔ MemoryPointer<
Y> Function<Y extends RType>(int byteOffset) -
Creates a new MemoryPointer from a given address.
getter/setter pair
-
fromBytes
↔ MemoryPointer<
RVoid> Function<T extends TypedDataList>(T data) -
Allocates a new pointer and writes
datainto it.getter/setter pair -
fromString
↔ MemoryPointer<
RUint8> Function(String text, [int? bufferSize]) -
Allocates a new NUL-terminated UTF-8 C string from
textand returns a pointer to it.getter/setter pair -
malloc
↔ MemoryPointer<
Y> Function<Y extends RType>(int byteOffset) -
Allocates a memory of given
size.getter/setter pair -
nullptr
↔ MemoryPointer<
Y> Function<Y extends RType>() -
Constructs a nullptr.
getter/setter pair