title: Dart: Error: Setter not found (when defining constructor of a class)
body: <p>I get the following error with this very simple constructor:</p>
  
  <pre><code>class MyHomePage extends StatefulWidget {
    MyHomePage(String title, String lang, {Key key}) {
      this.title = title;
      this.lang = lang.substring(0,2).toLowerCase();
      super(key: key);
    }
  
  
    final String title;
    final String lang;
  
    @override
    _MyHomePageState createState() =&gt; _MyHomePageState();
  }
  </code></pre>
  
  <p>The error message:</p>
  
  <pre><code>Compiler message:                                                       
  lib/main.dart:34:10: Error: Setter not found: 'title'.                  
      this.title = title;                                                 
           ^^^^^                                                          
  lib/main.dart:35:10: Error: Setter not found: 'lang'.                   
      this.lang = lang.substring(0,2).toLowerCase();                      
           ^^^^                                                           
  lib/main.dart:36:5: Error: Can't use 'super' as an expression.          
  To delegate a constructor to a super constructor, put the super call as an initializer.
      super(key: key);                                                    
      ^                                                                   
  lib/main.dart:34:10: Error: The setter 'title' isn't defined for the class 'MyHomePage
  </code></pre>
  
  <p>Why is that? I don't understand what that mean.
  Is there a comprehensive explanation about how to define constructors in dart? I couldn't find one on the dart.dev site.</p>
  
  <p>Edit:
  After editing the code to the following:</p>
  
  <pre><code>class MyHomePage extends StatefulWidget {
    MyHomePage(String title, String lang, {Key key}) {
      title = title;
      lang = lang.substring(0,2).toLowerCase();
      super(key: key);
    }
  
    final String title;
    final String lang;
  
    @override
    _MyHomePageState createState() =&gt; _MyHomePageState();
  }
  </code></pre>
  
  <p>I have the following complaints from the compiler:</p>
  
  <pre><code>Compiler message:                                                       
  lib/main.dart:36:5: Error: Can't use 'super' as an expression.          
  To delegate a constructor to a super constructor, put the super call as an initializer.
      super(key: key);                                                    
      ^                                                                   
  lib/main.dart:39:16: Error: Final field 'title' is not initialized.     
  Try to initialize the field in the declaration or in every constructor. 
    final String title;                                                   
                 ^^^^^                                                    
  lib/main.dart:40:16: Error: Final field 'lang' is not initialized.      
  Try to initialize the field in the declaration or in every constructor. 
    final String lang;     
  </code></pre>