createWithEmailAndPassword method

Future<void> createWithEmailAndPassword({
  1. required String nomComplet,
  2. required String userName,
  3. required String password,
})

Implementation

Future<void> createWithEmailAndPassword(
    {required String nomComplet,
    required String userName,
    required String password}) async {
  try {
    businessController.showDialogProgress(show: true);
    var firebaseAuth = FirebaseAuth.instance;
    var dataUser = await firebaseAuth.createUserWithEmailAndPassword(
        email: userName, password: password);
    UserModel user = UserModel();
    user = await userRepository.getUserUI(currentUser: dataUser.user);
    user.nomComplet = nomComplet;
    user.userName = userName;
    user.motDePasse = password;
    await sendVerificationEmail();
    businessController.showDialogProgress(show: false);
    //openPage();
    //RouteHelper.navToReplacementPage(RouteName.pageLoginPage);
    Navigator.pop(Get.context!);
  } on FirebaseAuthException catch (ex, trace) {
    logCat(ex.code);
    logCat(ex.message!);
    logError(ex, trace: trace, position: 'FirebaseAuthException');
    businessController.showDialogProgress(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.showDialogProgress(show: false);
    DialogView.showAlertDialog(eors: 'E', msg: ex.message!);
  } on Exception catch (ex, trace) {
    businessController.showDialogProgress(show: false);
    logError(ex, trace: trace, position: 'signInWithEmailAndPassword');
  }
}