signInWithEmailAndPassword method

Future signInWithEmailAndPassword({
  1. required String userName,
  2. required String password,
  3. String? redirect,
})

Implementation

Future signInWithEmailAndPassword(
    {required String userName,
    required String password,
    String? redirect}) async
{
  try {
    businessController.showCircularProgressIndicator(show: true);
    var dataUser = await firebaseAuth.signInWithEmailAndPassword(
        email: userName, password: password);
    UserModel user = UserModel();
    user = await userRepository.getUserUI(currentUser: dataUser.user);
    user.userName = userName;
    user.motDePasse = password;
    user.userCreated = 'email';
    await loginRegisterProvider(user: user, redirect: redirect);
  } on FirebaseAuthException catch (ex, trace) {
    logCat(ex.code);
    logCat(ex.message!);
    logError(ex, trace: trace, position: 'FirebaseAuthException');
    businessController.showCircularProgressIndicator(show: false);
    DialogView.showAlertDialog(eors: 'E', msg: ex.message!);
  } on PlatformException catch (ex, trace) {
    logError(ex, trace: trace, position: 'PlatformException');
    logCat(ex.code);
    logCat(ex.message!);
    businessController.showCircularProgressIndicator(show: false);
    DialogView.showAlertDialog(msg: getErrorMessage(ex));
  } on Exception catch (ex, trace) {
    businessController.showCircularProgressIndicator(show: false);
    logError(ex, trace: trace, position: 'signInWithEmailAndPassword');
  }
}