title: flutter firebase change email issue
body: <p>I have this code to change email. It works fine, except when i enter an email that is already available it still changes the email to that one. Even if i enter my own email again it changes it to that.</p>
  <pre class="lang-dart prettyprint-override"><code>Future&lt;void&gt; changeEmail(
        String email, String pass, String newEmail, User? user) async {
      final cred = EmailAuthProvider.credential(email: email, password: pass);
  
      if (user != null) {
        try {
          await user.reauthenticateWithCredential(cred).then(
            (value) {
              user.updateEmail(newEmail).then(
                (value) {
                  Fluttertoast.showToast(msg: 'Email Changed');
                },
              );
            },
          );
        } on FirebaseAuthException catch (e) {
          switch (e.code) {
            case 'email-already-in-use':
              Text('Error: Email already in use!');
              break;
            case 'invalid-email':
              Text('Error: Invalid email adress!');
              break;
            case 'operation-not-allowed':
              Text('Error: Something went wrong!');
              break;
            case 'weak-password':
              Text('Error: Weak password!');
              break;
            default:
              Text('Something went wrong!');
          }
        }
      }
    }
  </code></pre>
  <pre class="lang-dart prettyprint-override"><code>onPressed: () async {
                            setState(() {
                              _isLogginIn = true;
                              _message = &quot;&quot;;
                            });
                            if (_formKey.currentState!.validate()) {
                              
                                await AuthService()
                                    .changeEmail(
                                        email.text.trim(),
                                        pass.text.trim(),
                                        newEmail.text.trim(),
                                        user)
                                    .then((value) {});
                                await DatabaseService(uid: user?.uid)
                                    .updateEmail(newEmail.text.trim());
                            }
                            setState(
                              () {
                                _isLogginIn = false;
                              },
                            );
                          },
  </code></pre>
  <p>Anyone know what am i doing wrong?</p>