'Flutter Firebase Auth Password Reset

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!



Solution 1:[1]

//pass your email to sendPasswordResetEmail FirebaseAuth.instance.sendPasswordResetEmail(email: "[email protected]").then((_) { toast( "link has been sent to your email for password reset"); }).catchError((error) { showDialog( context: context, builder: (context) => ErrorLog( text: error.message.toString(), ), );

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Zubair Afzal