LogInWithEmailAndPasswordFailure.fromCode constructor

LogInWithEmailAndPasswordFailure.fromCode(
  1. String code
)

Create an authentication message from a firebase authentication exception code.

Implementation

factory LogInWithEmailAndPasswordFailure.fromCode(String code) {
  switch (code) {
    case 'invalid-email':
      return LogInWithEmailAndPasswordFailure(
        code,
        'Email is not valid or badly formatted.',
      );
    case 'user-disabled':
      return LogInWithEmailAndPasswordFailure(
        code,
        'This user has been disabled. Please contact support for help.',
      );
    case 'user-not-found':
      return LogInWithEmailAndPasswordFailure(
        code,
        'Email is not found, please create an account.',
      );
    case 'wrong-password':
      return LogInWithEmailAndPasswordFailure(
        code,
        'Incorrect password, please try again.',
      );
    default:
      return LogInWithEmailAndPasswordFailure(code);
  }
}