handleSignIn method

Future<void> handleSignIn(
  1. PhoneAuthCredential credential,
  2. Function onSuccess,
  3. Function onError
)

Implementation

Future<void> handleSignIn(PhoneAuthCredential credential, Function onSuccess, Function onError) async{
  await auth.signInWithCredential(credential).then((value) {
    onSuccess();
  }).catchError((error){
    AlertX.instance.showAlert(
        title: "Error",
        msg: error.message ?? "",
        negativeButtonText: null,
        positiveButtonText: "Done",
        negativeButtonPressed: (){},
        positiveButtonPressed: (){
          Navigation.instance.goBack();
        }
    );
    onError();
  });
}