title: initState() not called when building stateful widget
body: <p>I am trying to build a widget and do something in the initState() function. I have done it before in other cases, but this time the initState() is just not called. I have put breakpoints, the application goes into the constructor (assert line) and the object in the assert is not null, so it should go on and initialize the state. But it doesn't, and I don't understand why.</p>
  
  <p>Any help would be greatly appreciated. Thanks.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>class MyWidget extends StatefulWidget {
  
      SomeOtherObject someOtherObject;
  
      MyWidget({@required this.someOtherObject})
          :
              assert(someOtherObject != null)
      ;
  
      @override
      _MyWidgetState createState() =&gt; _MyWidgetState();
  }
  
  
  class _MyWidgetState extends State&lt;MyWidget&gt; {
  
      @override
      void initState() {
          super.initState();
          // widget.someOtherObject.addListener(update);
      }
  
      @override
      Widget build(BuildContext context) {
          // ...
      }
  }
  </code></pre>