skip to Main Content

Help me pls.
I have this error.
10Q

Unhandled Exception: NoSuchMethodError: Class ‘FirebaseAuthException’ has no instance getter ‘_message’.
E/flutter ( 5700): Receiver: Instance of ‘FirebaseAuthException’
E/flutter ( 5700): Tried calling: _message

await _auth
    .signInWithEmailAndPassword(
  email: _emailTextEditingController.text.trim(),
  password: _passwordTextEditingController.text.trim(),
)
    .then((authUser) {
  setState(() {
    firebaseUser = authUser.user;
  });
}).catchError((error) {
  showDialog(
      context: context,
      builder: (c) { 
        return ErrorAlertDialog(
          message: error._message == '[firebase_auth/user-not-found] There is no user record corresponding to this identifier. The user may have been deleted.'
            ? 'Email or password incorrect' : 'Error',
        );
      }); 
});
error._message == '[firebase_auth/user-not-found] There is no user record corresponding to this identifier. The user may have been deleted.'
            ? 'Email or password incorrect' : 'Error',

2

Answers


  1. You are being told that there is no getter named _message for FirebaseAuthException. If you go to the code for that class, or the documentation (here) and look at the methods you have available to you,
    _message is not one.

    There is one there (getErrorCode) that you should be able to compare with much easier.

    Login or Signup to reply.
  2. I think that the _message was called on null, I am not sure about this.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search