title: Flutter 2.0 / Dart - How to create a constructor with optional parameters?
body: <p>I created a class and want some of the parameters to be optional, but can't figure out how to do it.</p>
  <pre><code>class PageAction {
    PageState state;
    PageConfiguration page;
    List&lt;PageConfiguration&gt; pages;
    Widget widget;
  
    PageAction({
      this.state = PageState.none,
      this.page, // Optional
      this.pages, // Optional
      this.widget, // Optional
    });
  </code></pre>
  <p>I get the suggestion to add &quot;required&quot;, but that is not what I need. Can someone help and explain please?</p>