title: Why Statefull widget's build() function is called before initState()?
body: <p>I've created a wrapper to call init() with stateless widgets:</p>
  <pre><code>class StatefulWrapper extends StatefulWidget {
    StatefulWrapper({this.child, this.init});
    final Widget child;
    final void Function() init;
    @override
    _StatefulWrapperState createState() =&gt; _StatefulWrapperState();
  }
  
  class _StatefulWrapperState extends State&lt;StatefulWrapper&gt; {
    @override
    void initState() {
      if (widget.init != null) widget.init();
      super.initState();
    }
  
    @override
    Widget build(BuildContext context) =&gt; widget.child ?? SizedBox();
  }
  </code></pre>
  <p>And here's a simple example of using it:</p>
  <pre><code>class SomeView extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return StatefulWrapper(
        init: () =&gt; print('---------- step 1'),
        child: Scaffold(
          body: generateWidget(),
        ),
      );
    }
  }
  
  Widget generateWidget() {
    print('---------- step 2');
    return Container(width: 50, height: 50);
  }
  </code></pre>
  <p>Output:</p>
  <pre><code>I/flutter ( 2810): ---------- step 2
  I/flutter ( 2810): ---------- step 1
  </code></pre>
  <p><strong>Why step2 is printed before step1?</strong></p>
  <p>Flutter 1.22.2 stable</p>