title: Dart null safety: the operand cannot be null, so the condition is always true
body: <p>I am trying to double-check if the User object is successfully created, but Null saftey says
  <code>the operand cannot be null, so the condition is always true</code></p>
  <p>What if in a scenario where the json data contains invalid type, in this case there might be some errors when creating the user object</p>
  <pre><code>class User {
    String? name;
    String? age;
  
    User({name, age}) {
      this.name = name;
      this.age = age;
    }
  
    factory User.fromJson(dynamic json) {
      return User(name: json['name'], age: json['age']);
    }
  }
  
  void main() {
    String data = '{name: &quot;mike&quot;,age: &quot;2&quot;}';
  
    User user = User.fromJson(data);
  
    if (user != null) { // Warning: &quot;The operand can't be null, so the condition is always true. Remove the condition.&quot;
  
    }
  }
  </code></pre>
  <p>Please advise, Thank you! :)</p>