unlockCaptureOrientation method

  1. @override
Future<void> unlockCaptureOrientation(
  1. int cameraId
)

Unlocks the capture orientation.

Implementation

@override
Future<void> unlockCaptureOrientation(int cameraId) async {
  try {
    final web.ScreenOrientation orientation = window.screen.orientation;
    final web.Element? documentElement = window.document.documentElement;

    if (documentElement != null) {
      orientation.unlock();
    } else {
      throw PlatformException(
        code: CameraErrorCode.orientationNotSupported.toString(),
        message: 'Orientation is not supported in the current browser.',
      );
    }
  } on web.DOMException catch (e) {
    throw PlatformException(code: e.name, message: e.message);
  }
}