title: Passing data to StatefulWidget and accessing it in it's state in Flutter
body: <p>I have 2 screens in my Flutter app: a list of records and a screen for creating and editing records.</p>
  <p>If I pass an object to the second screen that means I am going to edit this and if I pass null it means that I am creating a new item. The editing screen is a Stateful widget and I am not sure how to use this approach <a href="https://flutter.io/cookbook/navigation/passing-data/" rel="noreferrer">https://flutter.io/cookbook/navigation/passing-data/</a> for my case.</p>
  <pre><code>class RecordPage extends StatefulWidget {
    final Record recordObject;
  
    RecordPage({Key key, @required this.recordObject}) : super(key: key);
  
    @override
    _RecordPageState createState() =&gt; new _RecordPageState();
  }
  
  class _RecordPageState extends State&lt;RecordPage&gt; {
    @override
    Widget build(BuildContext context) {
     //.....
    }
  }
  </code></pre>
  <p>How can I access <strong>recordObject</strong> inside <strong>_RecordPageState</strong>?</p>