Device orientation

Absolute device orientation readings based on accelerometer events.

Use to rotate certain widgets when user rotates the device without handling complex responsiveness.

device orientation demo


Note: On devices that does not have or support sensors orientation will default to DeviceOrientation.portraitUp.

Listen to a device orientation stream:

deviceOrientation$.listen((orientation) { 

Do some work based on current device orientation:

if (deviceOrientation == DeviceOrientation.portraitUp) {
  // ...

Use helper widget to make sure that user always sees critical widgets in correct orientation:

  child: Text("I'm readable!")

If you does not need animation use:

  child: Text("I'm readable!")