In dart using the ffi library we can create a Pointer object two ways

Pointer<NativeType> foo = allocate();
Pointer<NativeType> bar = Pointer.fromAddress(int address);

We can also get the Pointer objects address using int address = foo.address();

If we want to create a Pointer from another Pointer object doing final bar = Pointer.fromAddress(foo.address);

Will the resulting type of bar be Pointer<Pointer<Double>> or will bar just be a copy of foo where foo.address == bar.address

If it simply clones the Pointer, how can we create a Pointer to another Pointer?


Solution 1: cs guy

Here is an example:

    Pointer ptrToCopy; // i will assume that you have this already...
    Pointer<Pointer<NativeType>> _ptrToPtr = allocate();
    _ptrToPtr.value = Pointer.fromAddress(ptrToCopy.adress);