description

# address property

Pointer<Never> get address

The memory address of the underlying data.

An expression of the form `expression.address` denoting this `address` can only occurr as an entire argument expression in the invocation of a leaf Native external function.

Can only be used on fields of Struct subtypes, fields of Union subtypes, Array elements, or TypedData elements. In other words, the number whose address is being accessed must itself be acccessed through a Struct, Union, Array, or TypedData.

Example:

    @Native<Void Function(Pointer<Float>)>(isLeaf: true)
    external void myFunction(Pointer<Float> pointer);

    final class MyStruct extends Struct {
      @Float()
      external double x;

      @Float()
      external double y;

      @Array(10)
      external Array<Float> array;
    }

    void main() {
      final myStruct = Struct.create<MyStruct>();
      myFunction(myStruct.y.address);
      myFunction(myStruct.array[5].address);

      final list = Float32List(10);
      myFunction(list[5].address);
    }

The expression before `.address` is evaluated like the left-hand-side of an assignment, to something that gives access to the storage behind the expression, which can be used both for reading and writing. The `.address` then gives a native pointer to that storage.

The `.address` is evaluated just before calling into native code when invoking a leaf Native external function. This ensures the Dart garbage collector will not move the object that the address points in to.

## Implementation

    external Pointer<Never> get address;