setZoomScale method

Future<void> setZoomScale(
  1. double zoomScale
)

Set the zoomScale of the camera.

zoomScale must be within 0.0 and 1.0, where 1.0 is the max zoom, and 0.0 is zoomed out.

Implementation

Future<void> setZoomScale(double zoomScale) async {
  if (zoomScale < 0 || zoomScale > 1) {
    throw const MobileScannerException(
      errorCode: MobileScannerErrorCode.genericError,
      errorDetails: MobileScannerErrorDetails(
        message: 'The zoomScale must be between 0 and 1.',
      ),
    );
  }
  await _methodChannel.invokeMethod('setScale', zoomScale);
}