getDeviceOrientation method

  1. @override
Future<DeviceOrientationInfo> getDeviceOrientation()
override

Returns the current device orientation from the Android display.

Implementation

@override
Future<DeviceOrientationInfo> getDeviceOrientation() async {
  final Map<Object?, Object?>? orientationMap = await methodChannel
      .invokeMapMethod<Object?, Object?>('getDeviceOrientation');

  if (orientationMap == null) {
    throw PlatformException(
      code: 'native_lens_empty_device_orientation',
      message: 'Android returned empty device orientation information.',
    );
  }

  return DeviceOrientationInfo.fromMap(orientationMap);
}