detached property

D get detached

Returns a copy of the struct's current value, detached from its underlying memory.

The returned struct has no memory reference; further mutations to it are not written through, and further mutations to the backing memory are not reflected in it.

Throws a StateError if this struct requires it's live memory reference.

Implementation

D get detached {
  final value = this.value;
  if (value._requiresOp) {
    value.structSyncFromMemory();
    value.op = null;
  }
  return value;
}