title: Flutter Device Orientation
body: <p>I wonder why Flutter does wonderfully rotate from Portrait to Landscape if run on an iOS device but does not rotate at all on my Android device ??</p>
  
  <p>As a code example you find a "hello world" example below. Again, also for this simple code-example, Flutter rotates for iOS device out of the box but it does not rotate for Android. Why ??</p>
  
  <p>The same ist true for more complex Apps adding ListViews or other (i.e. iOS rotates nicely the screen, Android does not).</p>
  
  <p>I found something called <code>OrientationBuilder</code> (<a href="https://flutter.io/docs/cookbook/design/orientation" rel="noreferrer">link1</a>) or <code>MediaQuery.orientation</code> (<a href="https://stackoverflow.com/questions/50158364/in-flutter-widget-testing-how-to-make-media-orientation-to-portrait">link2</a>).
  But this seems only offering the capability to distinguish the device's orientations and then you have to act in code accordingly. This seems like a possible solution but I wonder why I have to invest extra Work for Android devices but not for iOS ?</p>
  
  <p>What I am looking for is an "AUTOMATIC" rotation possibility for Android under Flutter (just as iOS does it out of the box). How could I achieve this ?</p>
  
  <p>Here is two screenshots of my "hello world" example.
  (iOS rotates out of the box / Android does not):</p>
  
  <p><a href="https://i.stack.imgur.com/w7QPa.png" rel="noreferrer"><img src="https://i.stack.imgur.com/w7QPa.png" alt="enter image description here"></a><a href="https://i.stack.imgur.com/TEqgb.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TEqgb.png" alt="enter image description here"></a></p>
  
  <p>And here is the Dart-code:</p>
  
  <pre><code>import 'package:flutter/material.dart';
  
  void main() =&gt; runApp(MyApp());
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: MyHomePage(title: 'Flutter Demo Home Page'),
      );
    }
  }
  
  class MyHomePage extends StatefulWidget {
    MyHomePage({Key key, this.title}) : super(key: key);
    final String title;
  
    @override
    _MyHomePageState createState() =&gt; _MyHomePageState();
  }
  
  class _MyHomePageState extends State&lt;MyHomePage&gt; {
    int _counter = 0;
  
    void _incrementCounter() {
      setState(() {
        _counter = _counter + 2;
      });
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: &lt;Widget&gt;[
              Text(
                'You have pushed the button this many times:',
              ),
              Text(
                '$_counter',
                style: Theme.of(context).textTheme.display1,
              ),
            ],
          ),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: _incrementCounter,
          tooltip: 'Increment',
          child: Icon(Icons.add),
        ),
      );
    }
  }
  </code></pre>