lockCaptureOrientation method Null safety

Future<void> lockCaptureOrientation(
  1. [DeviceOrientation? orientation]
)

Locks the capture orientation.

If orientation is omitted, the current device orientation is used.

Implementation

Future<void> lockCaptureOrientation([DeviceOrientation? orientation]) async {
  try {
    await CameraPlatform.instance.lockCaptureOrientation(
        _cameraId, orientation ?? value.deviceOrientation);
    value = value.copyWith(
        lockedCaptureOrientation: Optional<DeviceOrientation>.of(
            orientation ?? value.deviceOrientation));
  } on PlatformException catch (e) {
    throw CameraException(e.code, e.message);
  }
}