title: Flutter define default value of a DateTime in constructor
body: <p>I have the state below and want to set the default for the DateTime in the constructor. I would like to have the current date as the default but I'm not sure if that is possible because it needs to be constant.<br />
  The <code>DateTime.now()</code> function or for example <code>DateTime.utc(1989, 11, 9)</code> also doesn't work but is there another way to assign a default DateTime?</p>
  <pre><code>class CreateDidState {
    final String firstname;
    final String lastName;
    final String email;
    final String phoneNumber;
    final DateTime dateOfBirth;
    final String sex;
    final String address;
    final String city;
    final String state;
    final String postalCode;
    final String country;
  
    CreateDidState(
        {this.firstname = &quot;&quot;,
        this.lastName = &quot;&quot;,
        this.email = &quot;&quot;,
        this.phoneNumber = &quot;&quot;,
        this.dateOfBirth = DateTime.now(), //The default value of an optional parameter must be constant.
        this.sex = &quot;&quot;,
        this.address = &quot;&quot;,
        this.city = &quot;&quot;,
        this.state = &quot;&quot;,
        this.postalCode = &quot;&quot;,
        this.country = &quot;&quot;});
  }
  
  </code></pre>