title: Dart assert if not null in constructor
body: <p>How to assert if a parameter is not null in a Dart constructor?</p>
  <pre><code>const CardStackCarousel({
      Key key,
      this.itemBuilder,
      this.itemCount,
      int backgroundItemCount,
      this.controller,
      this.offsetAboveBackcards: 10.0,
      this.minScale: 0.8,
      this.verticalAxis: false,
    })  : backgroundItemCount = backgroundItemCount == null ? itemCount - 1 : backgroundItemCount,
          assert(backgroundItemCount &lt; itemCount, 'background item must be less than itemCount'),
          super(key: key);
  </code></pre>
  <p>With the code above, I am getting a error:</p>
  <pre><code>The method '&lt;' was called on null.
  Receiver: null
  </code></pre>
  <p>When the user does not specify the backgroundItemCount property. So my idea is maybe we should only assert if this property is not null. But I can't figure out how to do that</p>