title: How to pass parameters to widgets in Flutter
body: <p>I am opening a modal dialog in Flutter and wish to pass in a single parameter (postId) to the modal for further processing. But this is generating an error as shown.</p>
  
  <pre><code>class SharingDialog extends StatefulWidget {
   @override
  
   final String postId;  // &lt;--- generates the error, "Field doesn't override an inherited getter or setter"
   SharingDialog({
     String postId
   }): this.postId = postId;
  
   SharingDialogState createState() =&gt; new SharingDialogState(postId);
  }
  
  class SharingDialogState extends State&lt;SharingDialog&gt; {
  
   SharingDialogState(this.postId);
   final String postId;
  
   @override
   Widget build(BuildContext context) {
     return new Scaffold(
       appBar: 
         child: AppBar(           
           title: const Text('Share this Post'),
        actions: [
          new FlatButton(
            onPressed: () {
              print("Sharing Post ID: " + this.postId);
            },
            child: new Text('SHARE)
          ),
        ],
      ),
    ),
    body: new Text("SHARING SCREEN"),
  );
  }
  </code></pre>
  
  <p>And then there is a click to open the modal using the following code which generates the accompanying error:</p>
  
  <p>Code: </p>
  
  <pre><code>return new SharingDialog(postId);
  </code></pre>
  
  <p>Error: <code>Too many positional arguments: 0 allowed, but 1 found.</code></p>
  
  <p>How do you pass parameter(s) if not this way?</p>