title: The parameter can't have a value of 'null' because of its type in Dart
body: <h2>Dart function</h2>
  <p>I have the following Dart function and I am now using null safety:</p>
  <pre class="lang-dart prettyprint-override"><code>void calculate({int factor}) {
    // ...
  }
  </code></pre>
  <p>The analyzer complains that:</p>
  <blockquote>
  <p>The parameter 'factor' can't have a value of 'null' because of its type, and no non-null default value is provided.</p>
  </blockquote>
  <h2>Flutter widget</h2>
  <p>This is also the case for my <code>StatelessWidget</code> in Flutter:</p>
  <pre class="lang-dart prettyprint-override"><code>class Foo extends StatelessWidget {
    const Foo({Key key}): super(key: key);
  
    // ...
  }
  </code></pre>
  <p>I get the following error:</p>
  <blockquote>
  <p>The parameter 'key' can't have a value of 'null' because of its type, and no non-null default value is provided.</p>
  </blockquote>
  <hr />
  <p>How can I resolve this issue?</p>