linkEmailPassword method

Future<void> linkEmailPassword(
  1. User user,
  2. dynamic referralCode
)

Implementation

Future<void> linkEmailPassword(User user, var referralCode) async {
  try {
    closeDialog();
    onLoginSuccessful(referralCode: referralCode, fromSignUp: true);
  } catch (e) {
    closeDialog();
    if (e.toString().contains("[firebase_auth/provider-already-linked]")) {
      CustomFlashWidget.showFlashMessage(
        type: FlashType.error,
        title: "Account already exist",
        message: "Please try a different email",
      );
    } else {
      CustomFlashWidget.showFlashMessage(
        type: FlashType.error,
        title: "Error",
        message: e.toString().contains(']')
            ? e.toString().split(']')[1]
            : e.toString(),
      );
    }
    if (kDebugMode) {
      print(e.toString());
    }
  }
}