toDartAndRelease method

PhotoOptions toDartAndRelease()

Eagerly copies all fields to a plain PhotoOptions value, detaches the finalizer, and frees native memory immediately. Use this only when you need an immutable snapshot; for streams prefer consuming the proxy fields lazily then letting it GC. Must not be called more than once.

Implementation

PhotoOptions toDartAndRelease() {
  final v = _native.ref.toDart();
  _finalizer?.detach(this);
  malloc.free(_native);
  return v;
}