title: cant define a const constructor for a class with non final fields Flutter
body: <p>I am trying to render a widget with flutter and I am getting the following errors:</p>
  <p>&quot;can't define a const constructor for a class with non final fields&quot;</p>
  <p>&quot;constant constructor can't call non-constant super constructor of State&quot;</p>
  <p>&quot;The name parameter 'Key' ins't defined&quot;</p>
  <p>The code with this errors is the following:</p>
  <pre><code>class ContainerButton extends StatefulWidget {
    @override
    ContainerButtonState createState() =&gt; ContainerButtonState();
  }
  
  class ContainerButtonState extends State&lt;ContainerButton&gt; {
    final ButtonType buttonType;
    const CustomButton({Key key, this.buttonType}) : super(key: key);
    @override
    Widget build(BuildContext context) {
      return Container(
        padding: EdgeInsets.all(21),
        color: Color(0xfff4f5f9),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: &lt;Widget&gt;[
            Flexible(
              child: CustomButton(buttonType: ButtonType.download),
            ),
            Flexible(
              child: CustomButton(buttonType: ButtonType.share),
            ),
            Flexible(
              child: CustomButton(buttonType: ButtonType.problem),
            ),
          ],
        ),
      );
    }
  }
  </code></pre>
  <p>I would appreciate any hint. Thank you,</p>