14
votes

I'm trying to utilize the Firebase Auth sendPasswordResetEmail() call in my app.

In my auth file I declare the following:

 Future<void> sendPasswordResetEmail(String email) async {
    return _firebaseAuth.sendPasswordResetEmail(email: email);
  }

I pass the Auth to my a form widget that takes in this password and has the following onPressed function once I submit.

onPressed: () async {
    var response = await checkEmail();
    setState(() {
        this._emailValidator = response;
    });
    if (_formKey.currentState.validate()) {
        _formKey.currentState.save();
        try {
            await widget.auth
                .sendPasswordResetEmail(_email);
        } catch (e) {
            print(e);
        }
    }

},

I get the following console message after running it with a proper email:

"Tried calling: sendPasswordResetEmail("[email protected]")" Note: I used a real email for this.

I've set up the Firebase email template system but have not received any email. Does anyone know how I can further troubleshoot this or why my email is not working?

Thanks!

1

1 Answers

8
votes

I figured this out. I was not correctly passing the auth down from my auth file to the new file. As such, the method was being called on null, resulting in NoSuchMethodError.