title: The argument type 'String?' can't be assigned to the parameter type 'String' while creating method to save data in Firestore
body: <p>When I try to create a method to save user data in the Firestore database
  when registering with Facebook or google or with email and password</p>
  <pre><code>  void saveUser(UserCredential user) async {
      await FireStoreUser().addUserToFireStore(
        UserModel(
          userId: user.user!.uid,
          email: user.user!.email,
          name: name == null ? user.user!.displayName : name,
          pic: '',
        ),
      );
    }
  </code></pre>
  <p>and that's the code from a related class</p>
  <pre><code>class FireStoreUser {
    final CollectionReference _collectionReference =
        FirebaseFirestore.instance.collection('Users');
  
    Future&lt;void&gt; addUserToFireStore(UserModel userModel) async {
      return await _collectionReference
          .doc(userModel.userId)
          .set(userModel.toJson());
    }
  }
  </code></pre>
  <p>this error comes
  <a href="https://i.stack.imgur.com/v3ddw.png" rel="nofollow noreferrer">Code in vs code</a>
  and this is the problem shown <a href="https://i.stack.imgur.com/lFjk0.png" rel="nofollow noreferrer">problems</a></p>
  <p>It used to work fine before but after flutter updates, it doesn't work anymore</p>