0
Good afternoon, I’m having a hard time keeping my login active in my app, either by email or by google account. I tried the Sharedpreferences method but I was not very successful.
This is the login button code:
DefaultButton(
text: "Continuar",
press: () async {
if (_formKey.currentState.validate()) {
_formKey.currentState.save();
try {
KeyboardUtil.hideKeyboard(context);
UserCredential user = await FirebaseAuth.instance
.signInWithEmailAndPassword(
email: email,
password: password);
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (context) => Tabs()),
(Route<dynamic> route) => false);
} on FirebaseAuthException catch (e) {
if (e.code == 'user-not-found') {
Fluttertoast.showToast(
msg: "Nenhum usuário encontrado para esse e-mail.");
print('Nenhum usuário encontrado para esse e-mail.');
} else if (e.code == 'wrong-password') {
Fluttertoast.showToast(
msg: "Senha errada fornecida para esse usuário.");
print('Senha errada fornecida para esse usuário.');
}
}
}
},
),
Thank you.