setFocusPoint method

Future<void> setFocusPoint(
  1. Offset position
)

Set the focus point for the camera.

The position must be a point between 0,0 and 1,1, both inclusive.

Does nothing if the camera is not running.

Implementation

Future<void> setFocusPoint(Offset position) async {
  _throwIfNotInitialized();

  if (!value.isRunning) {
    return;
  }

  final clampedPosition = Offset(
    position.dx.clamp(0, 1),
    position.dy.clamp(0, 1),
  );

  await MobileScannerPlatform.instance.setFocusPoint(clampedPosition);
}