Reading time: < 1 minute
To easily reset the password, follow these simple steps.
First, we will create the design of the password recovery screen where we will add a text box to enter the email to which the password reset email will be sent. Additionally, we will add a button to perform the sending action.
Next, we will add the following method to the ‘Send Email’ button’s onPressed action:
void sendEmail(context) async {
try {
final credential = await FirebaseAuth.instance.sendPasswordResetEmail(
email: input_email_recovery.getText(),
);
print("email sent");
} catch (e) {
print(e);
print("error in sending");
}
}
I hope this helps. Have a great day.