title: How to discern if an optional named parameter in dart was given?
body: <p>
  I am implementing a redux store where I treat the store as immutable. Therefore the store looks something like this:</p>
  
  <pre class="lang-dart prettyprint-override"><code>class State {
    final String firstname;
    final String lastname;
  
    State(this.firstname, this.lastname);
  
    State.initial()
        : this.firstname = null,
          this.lastname = null;
  
    State copy({String firstname, String lastname}) =&gt; 
      new State(firstname ?? this.firstname, lastname ?? this.lastname);
  }
  </code></pre>
  
  <p>This all works fine and I can copy the State and replace individual fields within the copy.</p>
  
  <pre class="lang-dart prettyprint-override"><code>state.copy(firstname: "foo");
  </code></pre>
  
  <p>but now I can't set a field back to null of course.</p>
  
  <pre class="lang-dart prettyprint-override"><code>state.copy(firstname: null); 
  </code></pre>
  
  <p>doesn't work.</p>
  
  <p>I also tried something like:</p>
  
  <pre class="lang-dart prettyprint-override"><code>State copy({String firstname = this.firstname, String lastname = this.lastname}) =&gt; ...
  </code></pre>
  
  <p>but Dart does not allow non const as default values.</p>