signInWithEmail method

Future<void> signInWithEmail(
  1. String email,
  2. String password,
  3. Function onSuccess,
  4. Function onError,
)

Implementation

Future<void> signInWithEmail(String email, String password, Function onSuccess, Function onError) async{
  try {
    await FirebaseAuth.instance.signInWithEmailAndPassword(
        email: email,
        password: password
    );
    onSuccess();
  } on FirebaseAuthException catch  (e) {
    print('Failed with error code: ${e.code}');
    AlertX.instance.showAlert(
        title: "Error",
        msg: e.message ?? "",
        negativeButtonText: null,
        positiveButtonText: "Done",
        negativeButtonPressed: (){},
        positiveButtonPressed: (){
          Navigation.instance.goBack();
        }
    );
    onError();
  }
}