Skip to content

DoublePointer

extension DoublePointer on Pointer<Double>

Extension on Pointer specialized for the type argument Double.

Properties

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);

Methods

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,
});

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);

Operators

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<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 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

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);