size property

(int, int)? get size

The resolution of the camera frame as (width, height).

Returns the native dimensions of incoming camera frames based on the actual sensor data, not the on-screen display size. If configurationOverride is set, uses those dimensions. On iOS, swaps width and height to account for portrait orientation rotation.

Returns

  • A tuple (int width, int height) of the frame resolution, or null if camera data unavailable

Implementation

(int, int)? get size {
  final int width;
  final int height;

  if (configurationOverride != null) {
    width = configurationOverride!.frameWidth;
    height = configurationOverride!.frameHeight;
  } else {
    final SenseData? camera = datasource.getLatestData(DataType.camera);
    if (camera is! CameraImpl) {
      return null;
    }

    width = camera.cameraConfiguration.frameWidth;
    height = camera.cameraConfiguration.frameHeight;
  }

  if (Platform.isIOS) {
    return (height, width);
  }

  return (width, height);
}