title: start date and end date validation in Flutter
body: <p>In the below code I need to put validation like if the startdate is null give error to user or display the date chosen. I'm not sure how to do it.</p>
  <pre class="lang-dart prettyprint-override"><code>String _displayText(String begin, DateTime? date) {
    if (date != null) {
      return '$begin Date: ${date.toString().split(' ')[0]}';
    } else {
      return 'Choose The Date';
    }
  }
  </code></pre>
  <p>In the below it will display the date</p>
  <pre class="lang-dart prettyprint-override"><code>Text(
    _displayText('Start', startdate),
    style: const TextStyle(
        fontWeight: FontWeight.bold, fontSize: 15, color: Colors.black),
  ),
  </code></pre>