pausePreview method

Future<void> pausePreview()

Pauses the current camera preview

Implementation

Future<void> pausePreview() async {
  if (value.isPreviewPaused || !value.isInitialized || _isDisposed) {
    return;
  }
  try {
    await CameraPlatform.instance.pausePreview(_cameraId);
    value = value.copyWith(
        isPreviewPaused: true,
        previewPauseOrientation: Optional<DeviceOrientation>.of(
            value.lockedCaptureOrientation ?? value.deviceOrientation));
  } on PlatformException catch (e) {
    throw CameraException(e.code, e.message);
  }
}