pausePreview method Null safety

Future<void> pausePreview()

Pauses the current camera preview

Implementation

Future<void> pausePreview() async {
  if (value.isPreviewPaused) {
    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);
  }
}