title: Dart: How do I use "optional chaining" or a default value?
body: <p>I'm coming from TypeScript to Dart because of Flutter and It's incredible how I can't do the simplest of things.</p>
  <p>I have <code>style?.p?</code> as <code>double?</code> and I would like to read its value or use <code>0.0</code> as a default. Like this:</p>
  <pre><code>EdgeInsets.all(style?.p != null ? style.p : 0.0))
  </code></pre>
  <p>... but Dart is saying <code>double?</code> can't be assigned to <code>double</code>. Well, I'm using this ternary expression to check for <code>null</code>, but I think Dart is not as smart as TypeScript in type inference.</p>
  <p><a href="https://i.stack.imgur.com/MHyIt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MHyIt.png" alt="enter image description here" /></a></p>
  <p>Any idea?</p>