toDartAndRelease method

CameraFrame toDartAndRelease()

Eagerly copies all fields to a plain CameraFrame 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

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