I can’t handle an error if the user tries to sign up using an already existing email
Future _createUser(Users user, String name, x) async {
UserCredential result = await FirebaseAuth.instance
.createUserWithEmailAndPassword(
email: _emailController.text.trim(),
password: _passwordController.text.trim());
try {
result;
} on FirebaseAuthException catch (e) {
if (e.code == 'firebase_auth/email-already-in-use') {
final snackBarx = SnackBar(
elevation: 0,
behavior: SnackBarBehavior.floating,
backgroundColor: Colors.transparent,
content: AwesomeSnackbarContent(
message: 'Error please log in again and try again',
contentType: ContentType.failure,
),
);
ScaffoldMessenger.of(context)
..hideCurrentSnackBar()
..showSnackBar(snackBarx);
2
Answers
In my application I handle like this:
Use this function:
Use it as:
Edit: List of all the auth codes
use error code after
auth/
i.eadmin-restricted-operation
,argument-error
…