title: Flutter - How do I check if a variable exists?
body: <p>I have two constructors in <strong>new_activity_config.dart</strong>. </p>
  
  <pre><code>  NewActivityConfig(this.activityType, {Key key, this.activity}) : super(key: key);
    NewActivityConfig.fromNewActivityConfig(this.activity, {Key key, this.activityType}) : super(key: key);
  </code></pre>
  
  <p>One takes in an <strong>activityType</strong>: this.name, this.image</p>
  
  <p>The other takes in an <strong>activity</strong>: this.name, this.image, this.status, this.scheduledStart, this.mapped, this.description, this.statistics, this.completionDate, this.duration</p>
  
  <p>When navigating from the Pick Activity screen, it will call the <strong>NewActivityConfig()</strong> constructor - because it is showing an empty Config page for the user to input values</p>
  
  <p>When selecting an already created activity, it will call the <strong>NewActivityConfig.fromNewActivityConfig()</strong>, passing in variables that had been previously input to fill the fields.</p>
  
  <p>In my TextField hintText, I would like to display the user's input description if the <strong>description</strong> variable exists. However, if the first constructor is called (not passing in any user's previous values) and getDescription() cannot be called because it hasn't been passed in - and receive the error: <code>The method getDescription() was called on null</code>. </p>
  
  <p>How can I check if this exists without running into null errors?</p>
  
  <pre><code>final description = TextField(
        decoration: InputDecoration(
          hintText:(widget.activity.getDescription() != null ? widget.activity.getDescription() : 'Enter an activity description'),
        )
      );
  </code></pre>