Skip to content

Pointer<T extends NativeType> final

final class Pointer<T extends NativeType> implements SizedNativeType

Represents a pointer into the native C memory. Cannot be extended.

Implemented types

Constructors

Pointer.fromAddress() factory

factory Pointer.fromAddress(int ptr)

Construction from raw integer.

Implementation
dart
external factory Pointer.fromAddress(int ptr);

Properties

address no setter

int get address

Access to the raw pointer value. On 32-bit systems, the upper 32-bits of the result are 0.

Implementation
dart
external int get address;

hashCode no setter override

int get hashCode

The hash code for a Pointer only depends on its address.

Implementation
dart
int get hashCode {
  return address.hashCode;
}

ref extension read / write

T get ref

A Dart view of the struct referenced by this pointer.

Reading ref creates a reference accessing the fields of this struct backed by native memory at address. The address must be aligned according to the struct alignment rules of the platform.

Assigning to ref copies contents of the struct into the native memory starting at address.

This extension method must be invoked on a receiver of type Pointer<T> where T is a compile-time constant type.

Available on Pointer<T extends NativeType>, provided by the StructPointer<T extends Struct> extension

Implementation
dart
external T get ref;

external set ref(T value);

ref extension read / write

T get ref

A Dart view of the union referenced by this pointer.

Reading ref creates a reference accessing the fields of this union backed by native memory at address. The address must be aligned according to the union alignment rules of the platform.

Assigning to ref copies contents of the union into the native memory starting at address.

This extension method must be invoked on a receiver of type Pointer<T> where T is a compile-time constant type.

Available on Pointer<T extends NativeType>, provided by the UnionPointer<T extends Union> extension

Implementation
dart
external T get ref;

external set ref(T value);

runtimeType no setter inherited

Type get runtimeType

A representation of the runtime type of the object.

Inherited from Object.

Implementation
dart
external Type get runtimeType;

value extension read / write

int get value

The integer at address.

Available on Pointer<T extends NativeType>, provided by the AbiSpecificIntegerPointer<T extends AbiSpecificInteger> extension

Implementation
dart
external int get value;

external void set value(int value);

value extension read / write

bool get value

The bool at address.

Available on Pointer<T extends NativeType>, provided by the BoolPointer extension

Implementation
dart
external bool get value;

external void set value(bool value);

value extension read / write

double get value

The double at address.

The address must be 8-byte aligned.

Available on Pointer<T extends NativeType>, provided by the DoublePointer extension

Implementation
dart
external double get value;

external void set value(double value);

value extension read / write

double get value

The float at address.

A Dart double loses precision before being stored, and the float value is converted to a double when it is loaded.

The address must be 4-byte aligned.

Available on Pointer<T extends NativeType>, provided by the FloatPointer extension

Implementation
dart
external double get value;

external void set value(double value);

value extension read / write

int get value

The 8-bit two's complement integer at address.

A Dart integer is truncated to 8 bits (as if by .toSigned(8)) before being stored, and the 8-bit value is sign-extended when it is loaded.

Available on Pointer<T extends NativeType>, provided by the Int8Pointer extension

Implementation
dart
external int get value;

external void set value(int value);

value extension read / write

int get value

The 16-bit two's complement integer at address.

A Dart integer is truncated to 16 bits (as if by .toSigned(16)) before being stored, and the 16-bit value is sign-extended when it is loaded.

The address must be 2-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Int16Pointer extension

Implementation
dart
external int get value;

external void set value(int value);

value extension read / write

int get value

The 32-bit two's complement integer at address.

A Dart integer is truncated to 32 bits (as if by .toSigned(32)) before being stored, and the 32-bit value is sign-extended when it is loaded.

The address must be 4-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Int32Pointer extension

Implementation
dart
external int get value;

external void set value(int value);

value extension read / write

int get value

The 64-bit two's complement integer at address.

The address must be 8-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Int64Pointer extension

Implementation
dart
external int get value;

external void set value(int value);

value extension read / write

Pointer<T> get value

The pointer at address.

A Pointer is unboxed before being stored (as if by .address), and the pointer is boxed (as if by Pointer.fromAddress) when loaded.

On 32-bit platforms the address must be 4-byte aligned, and on 64-bit platforms the address must be 8-byte aligned.

Available on Pointer<T extends NativeType>, provided by the PointerPointer<T extends NativeType> extension

Implementation
dart
external Pointer<T> get value;

external void set value(Pointer<T> value);

value extension read / write

int get value

The 8-bit unsigned integer at address.

A Dart integer is truncated to 8 bits (as if by .toUnsigned(8)) before being stored, and the 8-bit value is zero-extended when it is loaded.

Available on Pointer<T extends NativeType>, provided by the Uint8Pointer extension

Implementation
dart
external int get value;

external void set value(int value);

value extension read / write

int get value

The 16-bit unsigned integer at address.

A Dart integer is truncated to 16 bits (as if by .toUnsigned(16)) before being stored, and the 16-bit value is zero-extended when it is loaded.

The address must be 2-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Uint16Pointer extension

Implementation
dart
external int get value;

external void set value(int value);

value extension read / write

int get value

The 32-bit unsigned integer at address.

A Dart integer is truncated to 32 bits (as if by .toUnsigned(32)) before being stored, and the 32-bit value is zero-extended when it is loaded.

The address must be 4-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Uint32Pointer extension

Implementation
dart
external int get value;

external void set value(int value);

value extension read / write

int get value

The 64-bit unsigned integer at address.

The address must be 8-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Uint64Pointer extension

Implementation
dart
external int get value;

external void set value(int value);

Methods

asFunction() extension

DF asFunction<DF extends Function>({bool isLeaf = false})

Convert to Dart function, automatically marshalling the arguments and return value.

isLeaf specifies whether the function is a leaf function. Leaf functions are small, short-running, non-blocking functions which are not allowed to call back into Dart or use any Dart VM APIs. Leaf functions are invoked bypassing some of the heavier parts of the standard Dart-to-Native calling sequence which reduces the invocation overhead, making leaf calls faster than non-leaf calls. However, this implies that a thread executing a leaf function can't cooperate with the Dart runtime. A long running or blocking leaf function will delay any operation which requires synchronization between all threads associated with an isolate group until after the leaf function returns. For example, if one isolate in a group is trying to perform a GC and a second isolate is blocked in a leaf call, then the first isolate will have to pause and wait until this leaf call returns.

Available on Pointer<T extends NativeType>, provided by the NativeFunctionPointer<NF extends Function> extension

Implementation
dart
external DF asFunction<@DartRepresentationOf('NF') DF extends Function>({
  bool isLeaf = false,
});

asTypedList() extension

Float64List asTypedList(
  int length, {
  Pointer<NativeFinalizerFunction<Void Function(Pointer<Void> token)>>? finalizer,
  Pointer<Void>? token,
})

Creates a typed list view backed by memory in the address space.

The returned view will allow access to the memory range from address to address + sizeOf<Double>() * length.

The user has to ensure the memory range is accessible while using the returned list.

If provided, finalizer will be run on the pointer once the typed list is GCed. If provided, token will be passed to finalizer, otherwise the this pointer itself will be passed.

The address must be 8-byte aligned.

Available on Pointer<T extends NativeType>, provided by the DoublePointer extension

Implementation
dart
external Float64List asTypedList(
  int length, {
  @Since('3.1') Pointer<NativeFinalizerFunction>? finalizer,
  @Since('3.1') Pointer<Void>? token,
});

asTypedList() extension

Float32List asTypedList(
  int length, {
  Pointer<NativeFinalizerFunction<Void Function(Pointer<Void> token)>>? finalizer,
  Pointer<Void>? token,
})

Creates a typed list view backed by memory in the address space.

The returned view will allow access to the memory range from address to address + sizeOf<Float>() * length.

The user has to ensure the memory range is accessible while using the returned list.

If provided, finalizer will be run on the pointer once the typed list is GCed. If provided, token will be passed to finalizer, otherwise the this pointer itself will be passed.

The address must be 4-byte aligned.

Available on Pointer<T extends NativeType>, provided by the FloatPointer extension

Implementation
dart
external Float32List asTypedList(
  int length, {
  @Since('3.1') Pointer<NativeFinalizerFunction>? finalizer,
  @Since('3.1') Pointer<Void>? token,
});

asTypedList() extension

Int8List asTypedList(
  int length, {
  Pointer<NativeFinalizerFunction<Void Function(Pointer<Void> token)>>? finalizer,
  Pointer<Void>? token,
})

Creates a typed list view backed by memory in the address space.

The returned view will allow access to the memory range from address to address + sizeOf<Int8>() * length.

The user has to ensure the memory range is accessible while using the returned list.

If provided, finalizer will be run on the pointer once the typed list is GCed. If provided, token will be passed to finalizer, otherwise the this pointer itself will be passed.

Available on Pointer<T extends NativeType>, provided by the Int8Pointer extension

Implementation
dart
external Int8List asTypedList(
  int length, {
  @Since('3.1') Pointer<NativeFinalizerFunction>? finalizer,
  @Since('3.1') Pointer<Void>? token,
});

asTypedList() extension

Int16List asTypedList(
  int length, {
  Pointer<NativeFinalizerFunction<Void Function(Pointer<Void> token)>>? finalizer,
  Pointer<Void>? token,
})

Creates a typed list view backed by memory in the address space.

The returned view will allow access to the memory range from address to address + sizeOf<Int16>() * length.

The user has to ensure the memory range is accessible while using the returned list.

If provided, finalizer will be run on the pointer once the typed list is GCed. If provided, token will be passed to finalizer, otherwise the this pointer itself will be passed.

The address must be 2-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Int16Pointer extension

Implementation
dart
external Int16List asTypedList(
  int length, {
  @Since('3.1') Pointer<NativeFinalizerFunction>? finalizer,
  @Since('3.1') Pointer<Void>? token,
});

asTypedList() extension

Int32List asTypedList(
  int length, {
  Pointer<NativeFinalizerFunction<Void Function(Pointer<Void> token)>>? finalizer,
  Pointer<Void>? token,
})

Creates a typed list view backed by memory in the address space.

The returned view will allow access to the memory range from address to address + sizeOf<Int32>() * length.

The user has to ensure the memory range is accessible while using the returned list.

If provided, finalizer will be run on the pointer once the typed list is GCed. If provided, token will be passed to finalizer, otherwise the this pointer itself will be passed.

The address must be 4-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Int32Pointer extension

Implementation
dart
external Int32List asTypedList(
  int length, {
  @Since('3.1') Pointer<NativeFinalizerFunction>? finalizer,
  @Since('3.1') Pointer<Void>? token,
});

asTypedList() extension

Int64List asTypedList(
  int length, {
  Pointer<NativeFinalizerFunction<Void Function(Pointer<Void> token)>>? finalizer,
  Pointer<Void>? token,
})

Creates a typed list view backed by memory in the address space.

The returned view will allow access to the memory range from address to address + sizeOf<Int64>() * length.

The user has to ensure the memory range is accessible while using the returned list.

If provided, finalizer will be run on the pointer once the typed list is GCed. If provided, token will be passed to finalizer, otherwise the this pointer itself will be passed.

The address must be 8-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Int64Pointer extension

Implementation
dart
external Int64List asTypedList(
  int length, {
  @Since('3.1') Pointer<NativeFinalizerFunction>? finalizer,
  @Since('3.1') Pointer<Void>? token,
});

asTypedList() extension

Uint8List asTypedList(
  int length, {
  Pointer<NativeFinalizerFunction<Void Function(Pointer<Void> token)>>? finalizer,
  Pointer<Void>? token,
})

Creates a typed list view backed by memory in the address space.

The returned view will allow access to the memory range from address to address + sizeOf<Uint8>() * length.

The user has to ensure the memory range is accessible while using the returned list.

If provided, finalizer will be run on the pointer once the typed list is GCed. If provided, token will be passed to finalizer, otherwise the this pointer itself will be passed.

Available on Pointer<T extends NativeType>, provided by the Uint8Pointer extension

Implementation
dart
external Uint8List asTypedList(
  int length, {
  @Since('3.1') Pointer<NativeFinalizerFunction>? finalizer,
  @Since('3.1') Pointer<Void>? token,
});

asTypedList() extension

Uint16List asTypedList(
  int length, {
  Pointer<NativeFinalizerFunction<Void Function(Pointer<Void> token)>>? finalizer,
  Pointer<Void>? token,
})

Creates a typed list view backed by memory in the address space.

The returned view will allow access to the memory range from address to address + sizeOf<Uint16>() * length.

The user has to ensure the memory range is accessible while using the returned list.

If provided, finalizer will be run on the pointer once the typed list is GCed. If provided, token will be passed to finalizer, otherwise the this pointer itself will be passed.

The address must be 2-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Uint16Pointer extension

Implementation
dart
external Uint16List asTypedList(
  int length, {
  @Since('3.1') Pointer<NativeFinalizerFunction>? finalizer,
  @Since('3.1') Pointer<Void>? token,
});

asTypedList() extension

Uint32List asTypedList(
  int length, {
  Pointer<NativeFinalizerFunction<Void Function(Pointer<Void> token)>>? finalizer,
  Pointer<Void>? token,
})

Creates a typed list view backed by memory in the address space.

The returned view will allow access to the memory range from address to address + sizeOf<Uint32>() * length.

The user has to ensure the memory range is accessible while using the returned list.

If provided, finalizer will be run on the pointer once the typed list is GCed. If provided, token will be passed to finalizer, otherwise the this pointer itself will be passed.

The address must be 4-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Uint32Pointer extension

Implementation
dart
external Uint32List asTypedList(
  int length, {
  @Since('3.1') Pointer<NativeFinalizerFunction>? finalizer,
  @Since('3.1') Pointer<Void>? token,
});

asTypedList() extension

Uint64List asTypedList(
  int length, {
  Pointer<NativeFinalizerFunction<Void Function(Pointer<Void> token)>>? finalizer,
  Pointer<Void>? token,
})

Creates a typed list view backed by memory in the address space.

The returned view will allow access to the memory range from address to address + sizeOf<Uint64>() * length.

The user has to ensure the memory range is accessible while using the returned list.

If provided, finalizer will be run on the pointer once the typed list is GCed. If provided, token will be passed to finalizer, otherwise the this pointer itself will be passed.

The address must be 8-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Uint64Pointer extension

Implementation
dart
external Uint64List asTypedList(
  int length, {
  @Since('3.1') Pointer<NativeFinalizerFunction>? finalizer,
  @Since('3.1') Pointer<Void>? token,
});

cast()

Pointer<U> cast<U extends NativeType>()

Reinterprets the address of this pointer as the address of a U.

This function is completely unchecked, no attempts are made to validate that the bytes at the address are actually a valid native value of type U.

Implementation
dart
external Pointer<U> cast<U extends NativeType>();

deprecated elementAt() extension

Pointer<T> elementAt(int index)

DEPRECATED

Use operator + instead

Pointer arithmetic (takes element size into account).

Available on Pointer<T extends NativeType>, provided by the AbiSpecificIntegerPointer<T extends AbiSpecificInteger> extension

Implementation
dart
@Deprecated('Use operator + instead')
external Pointer<T> elementAt(int index);

deprecated elementAt() extension

Pointer<Bool> elementAt(int index)

DEPRECATED

Use operator + instead

Pointer arithmetic (takes element size into account).

Available on Pointer<T extends NativeType>, provided by the BoolPointer extension

Implementation
dart
@Deprecated('Use operator + instead')
Pointer<Bool> elementAt(int index) =>
    Pointer.fromAddress(address + sizeOf<Bool>() * index);

deprecated elementAt() extension

Pointer<Double> elementAt(int index)

DEPRECATED

Use operator + instead

Pointer arithmetic (takes element size into account).

Available on Pointer<T extends NativeType>, provided by the DoublePointer extension

Implementation
dart
@Deprecated('Use operator + instead')
Pointer<Double> elementAt(int index) =>
    Pointer.fromAddress(address + sizeOf<Double>() * index);

deprecated elementAt() extension

Pointer<Float> elementAt(int index)

DEPRECATED

Use operator + instead

Pointer arithmetic (takes element size into account).

Available on Pointer<T extends NativeType>, provided by the FloatPointer extension

Implementation
dart
@Deprecated('Use operator + instead')
Pointer<Float> elementAt(int index) =>
    Pointer.fromAddress(address + sizeOf<Float>() * index);

deprecated elementAt() extension

Pointer<Int8> elementAt(int index)

DEPRECATED

Use operator + instead

Pointer arithmetic (takes element size into account).

Available on Pointer<T extends NativeType>, provided by the Int8Pointer extension

Implementation
dart
@Deprecated('Use operator + instead')
Pointer<Int8> elementAt(int index) =>
    Pointer.fromAddress(address + sizeOf<Int8>() * index);

deprecated elementAt() extension

Pointer<Int16> elementAt(int index)

DEPRECATED

Use operator + instead

Pointer arithmetic (takes element size into account).

Available on Pointer<T extends NativeType>, provided by the Int16Pointer extension

Implementation
dart
@Deprecated('Use operator + instead')
Pointer<Int16> elementAt(int index) =>
    Pointer.fromAddress(address + sizeOf<Int16>() * index);

deprecated elementAt() extension

Pointer<Int32> elementAt(int index)

DEPRECATED

Use operator + instead

Pointer arithmetic (takes element size into account).

Available on Pointer<T extends NativeType>, provided by the Int32Pointer extension

Implementation
dart
@Deprecated('Use operator + instead')
Pointer<Int32> elementAt(int index) =>
    Pointer.fromAddress(address + sizeOf<Int32>() * index);

deprecated elementAt() extension

Pointer<Int64> elementAt(int index)

DEPRECATED

Use operator + instead

Pointer arithmetic (takes element size into account).

Available on Pointer<T extends NativeType>, provided by the Int64Pointer extension

Implementation
dart
@Deprecated('Use operator + instead')
Pointer<Int64> elementAt(int index) =>
    Pointer.fromAddress(address + sizeOf<Int64>() * index);

deprecated elementAt() extension

Pointer<Pointer<T>> elementAt(int index)

DEPRECATED

Use operator + instead

Pointer arithmetic (takes element size into account).

Available on Pointer<T extends NativeType>, provided by the PointerPointer<T extends NativeType> extension

Implementation
dart
@Deprecated('Use operator + instead')
external Pointer<Pointer<T>> elementAt(int index);

deprecated elementAt() extension

Pointer<T> elementAt(int index)

DEPRECATED

Use operator + instead

Pointer arithmetic (takes element size into account)

Available on Pointer<T extends NativeType>, provided by the StructPointer<T extends Struct> extension

Implementation
dart
@Deprecated('Use operator + instead')
external Pointer<T> elementAt(int index);

deprecated elementAt() extension

Pointer<Uint8> elementAt(int index)

DEPRECATED

Use operator + instead

Pointer arithmetic (takes element size into account).

Available on Pointer<T extends NativeType>, provided by the Uint8Pointer extension

Implementation
dart
@Deprecated('Use operator + instead')
Pointer<Uint8> elementAt(int index) =>
    Pointer.fromAddress(address + sizeOf<Uint8>() * index);

deprecated elementAt() extension

Pointer<Uint16> elementAt(int index)

DEPRECATED

Use operator + instead

Pointer arithmetic (takes element size into account).

Available on Pointer<T extends NativeType>, provided by the Uint16Pointer extension

Implementation
dart
@Deprecated('Use operator + instead')
Pointer<Uint16> elementAt(int index) =>
    Pointer.fromAddress(address + sizeOf<Uint16>() * index);

deprecated elementAt() extension

Pointer<Uint32> elementAt(int index)

DEPRECATED

Use operator + instead

Pointer arithmetic (takes element size into account).

Available on Pointer<T extends NativeType>, provided by the Uint32Pointer extension

Implementation
dart
@Deprecated('Use operator + instead')
Pointer<Uint32> elementAt(int index) =>
    Pointer.fromAddress(address + sizeOf<Uint32>() * index);

deprecated elementAt() extension

Pointer<Uint64> elementAt(int index)

DEPRECATED

Use operator + instead

Pointer arithmetic (takes element size into account).

Available on Pointer<T extends NativeType>, provided by the Uint64Pointer extension

Implementation
dart
@Deprecated('Use operator + instead')
Pointer<Uint64> elementAt(int index) =>
    Pointer.fromAddress(address + sizeOf<Uint64>() * index);

deprecated elementAt() extension

Pointer<T> elementAt(int index)

DEPRECATED

Use operator + instead

Pointer arithmetic (takes element size into account).

Available on Pointer<T extends NativeType>, provided by the UnionPointer<T extends Union> extension

Implementation
dart
@Deprecated('Use operator + instead')
external Pointer<T> elementAt(int index);

noSuchMethod() inherited

dynamic noSuchMethod(Invocation invocation)

Invoked when a nonexistent method or property is accessed.

A dynamic member invocation can attempt to call a member which doesn't exist on the receiving object. Example:

dart
dynamic object = 1;
object.add(42); // Statically allowed, run-time error

This invalid code will invoke the noSuchMethod method of the integer 1 with an Invocation representing the .add(42) call and arguments (which then throws).

Classes can override noSuchMethod to provide custom behavior for such invalid dynamic invocations.

A class with a non-default noSuchMethod invocation can also omit implementations for members of its interface. Example:

dart
class MockList<T> implements List<T> {
  noSuchMethod(Invocation invocation) {
    log(invocation);
    super.noSuchMethod(invocation); // Will throw.
  }
}
void main() {
  MockList().add(42);
}

This code has no compile-time warnings or errors even though the MockList class has no concrete implementation of any of the List interface methods. Calls to List methods are forwarded to noSuchMethod, so this code will log an invocation similar to Invocation.method(#add, [42]) and then throw.

If a value is returned from noSuchMethod, it becomes the result of the original invocation. If the value is not of a type that can be returned by the original invocation, a type error occurs at the invocation.

The default behavior is to throw a NoSuchMethodError.

Inherited from Object.

Implementation
dart
@pragma("vm:entry-point")
@pragma("wasm:entry-point")
external dynamic noSuchMethod(Invocation invocation);

refWithFinalizer() extension

T refWithFinalizer(
  Pointer<NativeFinalizerFunction<Void Function(Pointer<Void> token)>> finalizer, {
  Pointer<Void>? token,
})

A Dart view of the struct referenced by this pointer.

Creates a reference accessing the fields of this struct backed by native memory at address. The address must be aligned according to the struct alignment rules of the platform.

Attaches finalizer to the backing store of the struct. If provided, token will be passed to finalizer, otherwise the pointer (this) itself will be passed. The pointer (this) must not be used anymore if the struct is not guaranteed to be kept alive. Prefer doing any native calls with the pointer before calling refWithFinalizer.

This extension method must be invoked on a receiver of type Pointer<T> where T is a compile-time constant type.

Available on Pointer<T extends NativeType>, provided by the StructPointer<T extends Struct> extension

Implementation
dart
@Since('3.7')
external T refWithFinalizer(
  Pointer<NativeFinalizerFunction> finalizer, {
  Pointer<Void>? token,
});

refWithFinalizer() extension

T refWithFinalizer(
  Pointer<NativeFinalizerFunction<Void Function(Pointer<Void> token)>> finalizer, {
  Pointer<Void>? token,
})

A Dart view of the union referenced by this pointer.

Creates a reference accessing the fields of this union backed by native memory at address. The address must be aligned according to the union alignment rules of the platform.

Attaches finalizer to the backing store of the union. If provided, token will be passed to finalizer, otherwise the pointer (this) itself will be passed. The pointer (this) must not be used anymore if the union is not guaranteed to be kept alive. Prefer doing any native calls with the pointer before calling refWithFinalizer.

This extension method must be invoked on a receiver of type Pointer<T> where T is a compile-time constant type.

Available on Pointer<T extends NativeType>, provided by the UnionPointer<T extends Union> extension

Implementation
dart
@Since('3.7')
external T refWithFinalizer(
  Pointer<NativeFinalizerFunction> finalizer, {
  Pointer<Void>? token,
});

toString() inherited

String toString()

A string representation of this object.

Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.

Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.

Inherited from Object.

Implementation
dart
external String toString();

Operators

operator +() extension

Pointer<T> operator +(int offset)

A pointer to the offsetth T after this one.

Returns a pointer to the T whose address is offset times the size of T after the address of this pointer. That is (this + offset).address == this.address + offset * sizeOf<T>().

Also (this + offset).value is equivalent to this[offset], and similarly for setting.

Available on Pointer<T extends NativeType>, provided by the UnionPointer<T extends Union> extension

Implementation
dart
external Pointer<T> operator +(int offset);

operator +() extension

Pointer<T> operator +(int offset)

A pointer to the offsetth T after this one.

Returns a pointer to the T whose address is offset times the size of T after the address of this pointer. That is (this + offset).address == this.address + offset * sizeOf<T>().

Also (this + offset).value is equivalent to this[offset], and similarly for setting.

Available on Pointer<T extends NativeType>, provided by the AbiSpecificIntegerPointer<T extends AbiSpecificInteger> extension

Implementation
dart
external Pointer<T> operator +(int offset);

operator +() extension

Pointer<Bool> operator +(int offset)

A pointer to the offsetth Bool after this one.

Returns a pointer to the Bool whose address is offset times the size of Bool after the address of this pointer. That is (this + offset).address == this.address + offset * sizeOf<Bool>().

Also (this + offset).value is equivalent to this[offset], and similarly for setting.

Available on Pointer<T extends NativeType>, provided by the BoolPointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Bool> operator +(int offset) =>
    Pointer.fromAddress(address + sizeOf<Bool>() * offset);

operator +() extension

Pointer<Double> operator +(int offset)

A pointer to the offsetth Double after this one.

Returns a pointer to the Double whose address is offset times the size of Double after the address of this pointer. That is (this + offset).address == this.address + offset * sizeOf<Double>().

Also (this + offset).value is equivalent to this[offset], and similarly for setting.

Available on Pointer<T extends NativeType>, provided by the DoublePointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Double> operator +(int offset) =>
    Pointer.fromAddress(address + sizeOf<Double>() * offset);

operator +() extension

Pointer<Float> operator +(int offset)

A pointer to the offsetth Float after this one.

Returns a pointer to the Float whose address is offset times the size of Float after the address of this pointer. That is (this + offset).address == this.address + offset * sizeOf<Float>().

Also (this + offset).value is equivalent to this[offset], and similarly for setting.

Available on Pointer<T extends NativeType>, provided by the FloatPointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Float> operator +(int offset) =>
    Pointer.fromAddress(address + sizeOf<Float>() * offset);

operator +() extension

Pointer<Int8> operator +(int offset)

A pointer to the offsetth Int8 after this one.

Returns a pointer to the Int8 whose address is offset times the size of Int8 after the address of this pointer. That is (this + offset).address == this.address + offset * sizeOf<Int8>().

Also (this + offset).value is equivalent to this[offset], and similarly for setting.

Available on Pointer<T extends NativeType>, provided by the Int8Pointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Int8> operator +(int offset) =>
    Pointer.fromAddress(address + sizeOf<Int8>() * offset);

operator +() extension

Pointer<Int16> operator +(int offset)

A pointer to the offsetth Int16 after this one.

Returns a pointer to the Int16 whose address is offset times the size of Int16 after the address of this pointer. That is (this + offset).address == this.address + offset * sizeOf<Int16>().

Also (this + offset).value is equivalent to this[offset], and similarly for setting.

Available on Pointer<T extends NativeType>, provided by the Int16Pointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Int16> operator +(int offset) =>
    Pointer.fromAddress(address + sizeOf<Int16>() * offset);

operator +() extension

Pointer<Int32> operator +(int offset)

A pointer to the offsetth Int32 after this one.

Returns a pointer to the Int32 whose address is offset times the size of Int32 after the address of this pointer. That is (this + offset).address == this.address + offset * sizeOf<Int32>().

Also (this + offset).value is equivalent to this[offset], and similarly for setting.

Available on Pointer<T extends NativeType>, provided by the Int32Pointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Int32> operator +(int offset) =>
    Pointer.fromAddress(address + sizeOf<Int32>() * offset);

operator +() extension

Pointer<Int64> operator +(int offset)

A pointer to the offsetth Int64 after this one.

Returns a pointer to the Int64 whose address is offset times the size of Int64 after the address of this pointer. That is (this + offset).address == this.address + offset * sizeOf<Int64>().

Also (this + offset).value is equivalent to this[offset], and similarly for setting.

Available on Pointer<T extends NativeType>, provided by the Int64Pointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Int64> operator +(int offset) =>
    Pointer.fromAddress(address + sizeOf<Int64>() * offset);

operator +() extension

Pointer<Pointer<T>> operator +(int offset)

A pointer to the offsetth Pointer<T> after this one.

Returns a pointer to the Pointer<T> whose address is offset times the size of Pointer<T> after the address of this pointer. That is (this + offset).address == this.address + offset * sizeOf<Pointer<T>>().

Also (this + offset).value is equivalent to this[offset], and similarly for setting.

Available on Pointer<T extends NativeType>, provided by the PointerPointer<T extends NativeType> extension

Implementation
dart
external Pointer<Pointer<T>> operator +(int offset);

operator +() extension

Pointer<T> operator +(int offset)

A pointer to the offsetth T after this one.

Returns a pointer to the T whose address is offset times the size of T after the address of this pointer. That is (this + offset).address == this.address + offset * sizeOf<T>().

Also (this + offset).value is equivalent to this[offset], and similarly for setting.

Available on Pointer<T extends NativeType>, provided by the StructPointer<T extends Struct> extension

Implementation
dart
external Pointer<T> operator +(int offset);

operator +() extension

Pointer<Uint8> operator +(int offset)

A pointer to the offsetth Uint8 after this one.

Returns a pointer to the Uint8 whose address is offset times the size of Uint8 after the address of this pointer. That is (this + offset).address == this.address + offset * sizeOf<Uint8>().

Also (this + offset).value is equivalent to this[offset], and similarly for setting.

Available on Pointer<T extends NativeType>, provided by the Uint8Pointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Uint8> operator +(int offset) =>
    Pointer.fromAddress(address + sizeOf<Uint8>() * offset);

operator +() extension

Pointer<Uint16> operator +(int offset)

A pointer to the offsetth Uint16 after this one.

Returns a pointer to the Uint16 whose address is offset times the size of Uint16 after the address of this pointer. That is (this + offset).address == this.address + offset * sizeOf<Uint16>().

Also (this + offset).value is equivalent to this[offset], and similarly for setting.

Available on Pointer<T extends NativeType>, provided by the Uint16Pointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Uint16> operator +(int offset) =>
    Pointer.fromAddress(address + sizeOf<Uint16>() * offset);

operator +() extension

Pointer<Uint32> operator +(int offset)

A pointer to the offsetth Uint32 after this one.

Returns a pointer to the Uint32 whose address is offset times the size of Uint32 after the address of this pointer. That is (this + offset).address == this.address + offset * sizeOf<Uint32>().

Also (this + offset).value is equivalent to this[offset], and similarly for setting.

Available on Pointer<T extends NativeType>, provided by the Uint32Pointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Uint32> operator +(int offset) =>
    Pointer.fromAddress(address + sizeOf<Uint32>() * offset);

operator +() extension

Pointer<Uint64> operator +(int offset)

A pointer to the offsetth Uint64 after this one.

Returns a pointer to the Uint64 whose address is offset times the size of Uint64 after the address of this pointer. That is (this + offset).address == this.address + offset * sizeOf<Uint64>().

Also (this + offset).value is equivalent to this[offset], and similarly for setting.

Available on Pointer<T extends NativeType>, provided by the Uint64Pointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Uint64> operator +(int offset) =>
    Pointer.fromAddress(address + sizeOf<Uint64>() * offset);

operator -() extension

Pointer<T> operator -(int offset)

A pointer to the offsetth T before this one.

Equivalent to this + (-offset).

Returns a pointer to the T whose address is offset times the size of T before the address of this pointer. That is, (this - offset).address == this.address - offset * sizeOf<T>().

Also, (this - offset).value is equivalent to this[-offset], and similarly for setting,

Available on Pointer<T extends NativeType>, provided by the StructPointer<T extends Struct> extension

Implementation
dart
external Pointer<T> operator -(int offset);

operator -() extension

Pointer<Uint32> operator -(int offset)

A pointer to the offsetth Uint32 before this one.

Equivalent to this + (-offset).

Returns a pointer to the Uint32 whose address is offset times the size of Uint32 before the address of this pointer. That is, (this - offset).address == this.address - offset * sizeOf<Uint32>().

Also, (this - offset).value is equivalent to this[-offset], and similarly for setting,

Available on Pointer<T extends NativeType>, provided by the Uint32Pointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Uint32> operator -(int offset) =>
    Pointer.fromAddress(address - sizeOf<Uint32>() * offset);

operator -() extension

Pointer<Uint8> operator -(int offset)

A pointer to the offsetth Uint8 before this one.

Equivalent to this + (-offset).

Returns a pointer to the Uint8 whose address is offset times the size of Uint8 before the address of this pointer. That is, (this - offset).address == this.address - offset * sizeOf<Uint8>().

Also, (this - offset).value is equivalent to this[-offset], and similarly for setting,

Available on Pointer<T extends NativeType>, provided by the Uint8Pointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Uint8> operator -(int offset) =>
    Pointer.fromAddress(address - sizeOf<Uint8>() * offset);

operator -() extension

Pointer<Int16> operator -(int offset)

A pointer to the offsetth Int16 before this one.

Equivalent to this + (-offset).

Returns a pointer to the Int16 whose address is offset times the size of Int16 before the address of this pointer. That is, (this - offset).address == this.address - offset * sizeOf<Int16>().

Also, (this - offset).value is equivalent to this[-offset], and similarly for setting,

Available on Pointer<T extends NativeType>, provided by the Int16Pointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Int16> operator -(int offset) =>
    Pointer.fromAddress(address - sizeOf<Int16>() * offset);

operator -() extension

Pointer<Int32> operator -(int offset)

A pointer to the offsetth Int32 before this one.

Equivalent to this + (-offset).

Returns a pointer to the Int32 whose address is offset times the size of Int32 before the address of this pointer. That is, (this - offset).address == this.address - offset * sizeOf<Int32>().

Also, (this - offset).value is equivalent to this[-offset], and similarly for setting,

Available on Pointer<T extends NativeType>, provided by the Int32Pointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Int32> operator -(int offset) =>
    Pointer.fromAddress(address - sizeOf<Int32>() * offset);

operator -() extension

Pointer<Float> operator -(int offset)

A pointer to the offsetth Float before this one.

Equivalent to this + (-offset).

Returns a pointer to the Float whose address is offset times the size of Float before the address of this pointer. That is, (this - offset).address == this.address - offset * sizeOf<Float>().

Also, (this - offset).value is equivalent to this[-offset], and similarly for setting,

Available on Pointer<T extends NativeType>, provided by the FloatPointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Float> operator -(int offset) =>
    Pointer.fromAddress(address - sizeOf<Float>() * offset);

operator -() extension

Pointer<Bool> operator -(int offset)

A pointer to the offsetth Bool before this one.

Equivalent to this + (-offset).

Returns a pointer to the Bool whose address is offset times the size of Bool before the address of this pointer. That is, (this - offset).address == this.address - offset * sizeOf<Bool>().

Also, (this - offset).value is equivalent to this[-offset], and similarly for setting,

Available on Pointer<T extends NativeType>, provided by the BoolPointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Bool> operator -(int offset) =>
    Pointer.fromAddress(address - sizeOf<Bool>() * offset);

operator -() extension

Pointer<Int64> operator -(int offset)

A pointer to the offsetth Int64 before this one.

Equivalent to this + (-offset).

Returns a pointer to the Int64 whose address is offset times the size of Int64 before the address of this pointer. That is, (this - offset).address == this.address - offset * sizeOf<Int64>().

Also, (this - offset).value is equivalent to this[-offset], and similarly for setting,

Available on Pointer<T extends NativeType>, provided by the Int64Pointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Int64> operator -(int offset) =>
    Pointer.fromAddress(address - sizeOf<Int64>() * offset);

operator -() extension

Pointer<Pointer<T>> operator -(int offset)

A pointer to the offsetth Pointer<T> before this one.

Equivalent to this + (-offset).

Returns a pointer to the Pointer<T> whose address is offset times the size of Pointer<T> before the address of this pointer. That is, (this - offset).address == this.address - offset * sizeOf<Pointer<T>>().

Also, (this - offset).value is equivalent to this[-offset], and similarly for setting,

Available on Pointer<T extends NativeType>, provided by the PointerPointer<T extends NativeType> extension

Implementation
dart
external Pointer<Pointer<T>> operator -(int offset);

operator -() extension

Pointer<Int8> operator -(int offset)

A pointer to the offsetth Int8 before this one.

Equivalent to this + (-offset).

Returns a pointer to the Int8 whose address is offset times the size of Int8 before the address of this pointer. That is, (this - offset).address == this.address - offset * sizeOf<Int8>().

Also, (this - offset).value is equivalent to this[-offset], and similarly for setting,

Available on Pointer<T extends NativeType>, provided by the Int8Pointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Int8> operator -(int offset) =>
    Pointer.fromAddress(address - sizeOf<Int8>() * offset);

operator -() extension

Pointer<T> operator -(int offset)

A pointer to the offsetth T before this one.

Equivalent to this + (-offset).

Returns a pointer to the T whose address is offset times the size of T before the address of this pointer. That is, (this - offset).address == this.address - offset * sizeOf<T>().

Also, (this - offset).value is equivalent to this[-offset], and similarly for setting,

Available on Pointer<T extends NativeType>, provided by the UnionPointer<T extends Union> extension

Implementation
dart
external Pointer<T> operator -(int offset);

operator -() extension

Pointer<T> operator -(int offset)

A pointer to the offsetth T before this one.

Equivalent to this + (-offset).

Returns a pointer to the T whose address is offset times the size of T before the address of this pointer. That is, (this - offset).address == this.address - offset * sizeOf<T>().

Also, (this - offset).value is equivalent to this[-offset], and similarly for setting,

Available on Pointer<T extends NativeType>, provided by the AbiSpecificIntegerPointer<T extends AbiSpecificInteger> extension

Implementation
dart
external Pointer<T> operator -(int offset);

operator -() extension

Pointer<Uint64> operator -(int offset)

A pointer to the offsetth Uint64 before this one.

Equivalent to this + (-offset).

Returns a pointer to the Uint64 whose address is offset times the size of Uint64 before the address of this pointer. That is, (this - offset).address == this.address - offset * sizeOf<Uint64>().

Also, (this - offset).value is equivalent to this[-offset], and similarly for setting,

Available on Pointer<T extends NativeType>, provided by the Uint64Pointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Uint64> operator -(int offset) =>
    Pointer.fromAddress(address - sizeOf<Uint64>() * offset);

operator -() extension

Pointer<Uint16> operator -(int offset)

A pointer to the offsetth Uint16 before this one.

Equivalent to this + (-offset).

Returns a pointer to the Uint16 whose address is offset times the size of Uint16 before the address of this pointer. That is, (this - offset).address == this.address - offset * sizeOf<Uint16>().

Also, (this - offset).value is equivalent to this[-offset], and similarly for setting,

Available on Pointer<T extends NativeType>, provided by the Uint16Pointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Uint16> operator -(int offset) =>
    Pointer.fromAddress(address - sizeOf<Uint16>() * offset);

operator -() extension

Pointer<Double> operator -(int offset)

A pointer to the offsetth Double before this one.

Equivalent to this + (-offset).

Returns a pointer to the Double whose address is offset times the size of Double before the address of this pointer. That is, (this - offset).address == this.address - offset * sizeOf<Double>().

Also, (this - offset).value is equivalent to this[-offset], and similarly for setting,

Available on Pointer<T extends NativeType>, provided by the DoublePointer extension

Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Double> operator -(int offset) =>
    Pointer.fromAddress(address - sizeOf<Double>() * offset);

operator ==() override

bool operator ==(Object other)

Equality for Pointers only depends on their address.

Implementation
dart
bool operator ==(Object other) {
  if (other is! Pointer) return false;
  Pointer otherPointer = other;
  return address == otherPointer.address;
}

operator extension

double operator [](int index)

The float at address + sizeOf<Float>() * index.

A Dart double loses precision before being stored, and the float value is converted to a double when it is loaded.

The address must be 4-byte aligned.

Available on Pointer<T extends NativeType>, provided by the FloatPointer extension

Implementation
dart
external double operator [](int index);

operator extension

bool operator [](int index)

The bool at address + sizeOf<Bool>() * index.

Available on Pointer<T extends NativeType>, provided by the BoolPointer extension

Implementation
dart
external bool operator [](int index);

operator extension

int operator [](int index)

The 64-bit two's complement integer at address + sizeOf<Int64>() * index.

The address must be 8-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Int64Pointer extension

Implementation
dart
external int operator [](int index);

operator extension

int operator [](int index)

The 16-bit two's complement integer at address + sizeOf<Int16>() * index.

A Dart integer is truncated to 16 bits (as if by .toSigned(16)) before being stored, and the 16-bit value is sign-extended when it is loaded.

The address must be 2-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Int16Pointer extension

Implementation
dart
external int operator [](int index);

operator extension

Pointer<T> operator [](int index)

Load a Dart value from this location offset by index.

A Pointer is unboxed before being stored (as if by .address), and the pointer is boxed (as if by Pointer.fromAddress) when loaded.

On 32-bit platforms the address must be 4-byte aligned, and on 64-bit platforms the address must be 8-byte aligned.

Available on Pointer<T extends NativeType>, provided by the PointerPointer<T extends NativeType> extension

Implementation
dart
external Pointer<T> operator [](int index);

operator extension

int operator [](int index)

The 32-bit unsigned integer at address + sizeOf<Uint32>() * index.

A Dart integer is truncated to 32 bits (as if by .toUnsigned(32)) before being stored, and the 32-bit value is zero-extended when it is loaded.

The address must be 4-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Uint32Pointer extension

Implementation
dart
external int operator [](int index);

operator extension

double operator [](int index)

The double at address + sizeOf<Double>() * index.

The address must be 8-byte aligned.

Available on Pointer<T extends NativeType>, provided by the DoublePointer extension

Implementation
dart
external double operator [](int index);

operator extension

int operator [](int index)

The 8-bit two's complement integer at address + sizeOf<Int8>() * index.

A Dart integer is truncated to 8 bits (as if by .toSigned(8)) before being stored, and the 8-bit value is sign-extended when it is loaded.

Available on Pointer<T extends NativeType>, provided by the Int8Pointer extension

Implementation
dart
external int operator [](int index);

operator extension

T operator [](int index)

Creates a reference to access the fields of this struct backed by native memory at address + sizeOf<T>() * index.

The address must be aligned according to the struct alignment rules of the platform.

This extension method must be invoked on a receiver of type Pointer<T> where T is a compile-time constant type.

Available on Pointer<T extends NativeType>, provided by the StructPointer<T extends Struct> extension

Implementation
dart
external T operator [](int index);

operator extension

T operator [](int index)

Creates a reference to access the fields of this union backed by native memory at address + sizeOf<T>() * index.

The address must be aligned according to the union alignment rules of the platform.

This extension method must be invoked on a receiver of type Pointer<T> where T is a compile-time constant type.

Available on Pointer<T extends NativeType>, provided by the UnionPointer<T extends Union> extension

Implementation
dart
external T operator [](int index);

operator extension

int operator [](int index)

The 32-bit two's complement integer at address + sizeOf<Int32>() * index.

A Dart integer is truncated to 32 bits (as if by .toSigned(32)) before being stored, and the 32-bit value is sign-extended when it is loaded.

The address must be 4-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Int32Pointer extension

Implementation
dart
external int operator [](int index);

operator extension

int operator [](int index)

The 8-bit unsigned integer at address + sizeOf<Uint8>() * index.

A Dart integer is truncated to 8 bits (as if by .toUnsigned(8)) before being stored, and the 8-bit value is zero-extended when it is loaded.

Available on Pointer<T extends NativeType>, provided by the Uint8Pointer extension

Implementation
dart
external int operator [](int index);

operator extension

int operator [](int index)

The integer at address + sizeOf<T>() * index.

Available on Pointer<T extends NativeType>, provided by the AbiSpecificIntegerPointer<T extends AbiSpecificInteger> extension

Implementation
dart
external int operator [](int index);

operator extension

int operator [](int index)

The 64-bit unsigned integer at address + sizeOf<Uint64>() * index.

The address must be 8-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Uint64Pointer extension

Implementation
dart
external int operator [](int index);

operator extension

int operator [](int index)

The 16-bit unsigned integer at address + sizeOf<Uint16>() * index.

A Dart integer is truncated to 16 bits (as if by .toUnsigned(16)) before being stored, and the 16-bit value is zero-extended when it is loaded.

The address must be 2-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Uint16Pointer extension

Implementation
dart
external int operator [](int index);

operator []=() extension

void operator []=(int index, int value)

The 16-bit unsigned integer at address + sizeOf<Uint16>() * index.

A Dart integer is truncated to 16 bits (as if by .toUnsigned(16)) before being stored, and the 16-bit value is zero-extended when it is loaded.

The address must be 2-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Uint16Pointer extension

Implementation
dart
external void operator []=(int index, int value);

operator []=() extension

void operator []=(int index, int value)

The 8-bit unsigned integer at address + sizeOf<Uint8>() * index.

A Dart integer is truncated to 8 bits (as if by .toUnsigned(8)) before being stored, and the 8-bit value is zero-extended when it is loaded.

Available on Pointer<T extends NativeType>, provided by the Uint8Pointer extension

Implementation
dart
external void operator []=(int index, int value);

operator []=() extension

void operator []=(int index, T value)

Copies the value struct into native memory, starting at address * sizeOf<T>() * index.

This extension method must be invoked on a receiver of type Pointer<T> where T is a compile-time constant type.

Available on Pointer<T extends NativeType>, provided by the StructPointer<T extends Struct> extension

Implementation
dart
external void operator []=(int index, T value);

operator []=() extension

void operator []=(int index, Pointer<T> value)

Store a Dart value into this location offset by index.

A Pointer is unboxed before being stored (as if by .address), and the pointer is boxed (as if by Pointer.fromAddress) when loaded.

On 32-bit platforms the address must be 4-byte aligned, and on 64-bit platforms the address must be 8-byte aligned.

Available on Pointer<T extends NativeType>, provided by the PointerPointer<T extends NativeType> extension

Implementation
dart
external void operator []=(int index, Pointer<T> value);

operator []=() extension

void operator []=(int index, int value)

The 32-bit unsigned integer at address + sizeOf<Uint32>() * index.

A Dart integer is truncated to 32 bits (as if by .toUnsigned(32)) before being stored, and the 32-bit value is zero-extended when it is loaded.

The address must be 4-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Uint32Pointer extension

Implementation
dart
external void operator []=(int index, int value);

operator []=() extension

void operator []=(int index, int value)

The integer at address + sizeOf<T>() * index.

Available on Pointer<T extends NativeType>, provided by the AbiSpecificIntegerPointer<T extends AbiSpecificInteger> extension

Implementation
dart
external void operator []=(int index, int value);

operator []=() extension

void operator []=(int index, double value)

The double at address + sizeOf<Double>() * index.

The address must be 8-byte aligned.

Available on Pointer<T extends NativeType>, provided by the DoublePointer extension

Implementation
dart
external void operator []=(int index, double value);

operator []=() extension

void operator []=(int index, int value)

The 32-bit two's complement integer at address + sizeOf<Int32>() * index.

A Dart integer is truncated to 32 bits (as if by .toSigned(32)) before being stored, and the 32-bit value is sign-extended when it is loaded.

The address must be 4-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Int32Pointer extension

Implementation
dart
external void operator []=(int index, int value);

operator []=() extension

void operator []=(int index, int value)

The 64-bit unsigned integer at address + sizeOf<Uint64>() * index.

The address must be 8-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Uint64Pointer extension

Implementation
dart
external void operator []=(int index, int value);

operator []=() extension

void operator []=(int index, double value)

The float at address + sizeOf<Float>() * index.

A Dart double loses precision before being stored, and the float value is converted to a double when it is loaded.

The address must be 4-byte aligned.

Available on Pointer<T extends NativeType>, provided by the FloatPointer extension

Implementation
dart
external void operator []=(int index, double value);

operator []=() extension

void operator []=(int index, int value)

The 16-bit two's complement integer at address + sizeOf<Int16>() * index.

A Dart integer is truncated to 16 bits (as if by .toSigned(16)) before being stored, and the 16-bit value is sign-extended when it is loaded.

The address must be 2-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Int16Pointer extension

Implementation
dart
external void operator []=(int index, int value);

operator []=() extension

void operator []=(int index, int value)

The 8-bit two's complement integer at address + sizeOf<Int8>() * index.

A Dart integer is truncated to 8 bits (as if by .toSigned(8)) before being stored, and the 8-bit value is sign-extended when it is loaded.

Available on Pointer<T extends NativeType>, provided by the Int8Pointer extension

Implementation
dart
external void operator []=(int index, int value);

operator []=() extension

void operator []=(int index, T value)

Copies the value union into native memory, starting at address * sizeOf<T>() * index.

This extension method must be invoked on a receiver of type Pointer<T> where T is a compile-time constant type.

Available on Pointer<T extends NativeType>, provided by the UnionPointer<T extends Union> extension

Implementation
dart
external void operator []=(int index, T value);

operator []=() extension

void operator []=(int index, bool value)

The bool at address + sizeOf<Bool>() * index.

Available on Pointer<T extends NativeType>, provided by the BoolPointer extension

Implementation
dart
external void operator []=(int index, bool value);

operator []=() extension

void operator []=(int index, int value)

The 64-bit two's complement integer at address + sizeOf<Int64>() * index.

The address must be 8-byte aligned.

Available on Pointer<T extends NativeType>, provided by the Int64Pointer extension

Implementation
dart
external void operator []=(int index, int value);

Static Methods

fromFunction()

Pointer<NativeFunction<T>> fromFunction<T extends Function>(
  Function f, [
  Object? exceptionalReturn,
])

Convert Dart function to a C function pointer, automatically marshalling the arguments and return value

If an exception is thrown while calling f(), the native function will return exceptionalReturn, which must be assignable to return type of f.

The returned function address can only be invoked on the mutator (main) thread of the current isolate. It will abort the process if invoked on any other thread. Use NativeCallable.listener to create callbacks that can be invoked from any thread.

The pointer returned will remain alive for the duration of the current isolate's lifetime. After the isolate it was created in is terminated, invoking it from native code will cause undefined behavior.

Pointer.fromFunction only accepts static or top level functions. Use NativeCallable.isolateLocal to create callbacks from any Dart function or closure.

Implementation
dart
external static Pointer<NativeFunction<T>> fromFunction<T extends Function>(
  @DartRepresentationOf('T') Function f, [
  Object? exceptionalReturn,
]);