setOrientation static method

Future<void> setOrientation(
  1. DeviceOrientation orientation
)

Sets the preferred orientation for the app.

When the app opens, it will automatically change orientation to the preferred one (if possible) depending on the physical orientation of the device.

Example:

await EaseDevice.setOrientation(DeviceOrientation.portraitUp);

Implementation

static Future<void> setOrientation(DeviceOrientation orientation) {
  return SystemChrome.setPreferredOrientations(
    <DeviceOrientation>[orientation],
  );
}