cameraFrameRpcFields function

Map<String, dynamic> cameraFrameRpcFields(
  1. CameraFrame frame, [
  2. Map<String, dynamic> extra = const {}
])

Builds the isolate-request field map for a CameraFrame payload, merged with any extra per-op fields (e.g. maxDim, mode, outputFormat).

frame's bytes are wrapped for zero-copy transfer on native (via TransferableTypedData) and passed through unchanged on web. Reconstruct on the isolate side with cameraFrameFromRpcMessage.

Implementation

Map<String, dynamic> cameraFrameRpcFields(
  CameraFrame frame, [
  Map<String, dynamic> extra = const {},
]) => {
  'bytes': transferableBytes(frame.bytes),
  'width': frame.width,
  'height': frame.height,
  'strideCols': frame.strideCols,
  'conversion': frame.conversion.index,
  'rotation': frame.rotation?.index,
  ...extra,
};