unBlockUser method

dynamic unBlockUser(
  1. BuildContext context
)

Implementation

unBlockUser(BuildContext context) {
  Future.delayed(const Duration(milliseconds: 100), () {
    Helper.showAlert(
        message: "${AppConstants.unblock} ${profile.getName()}?",
        actions: [
          TextButton(
              onPressed: () {
                // Get.back();
                Navigator.pop(context);
              },
              child: Text(
                AppConstants.cancel.toUpperCase(),
                style:
                    TextStyle(color: MirrorflyUikit.getTheme?.primaryColor),
              )),
          TextButton(
              onPressed: () async {
                if (await AppUtils.isNetConnected()) {
                  // Get.back();
                  if (context.mounted) Navigator.pop(context);
                  // if (context.mounted) Helper.showLoading(message: "Unblocking User",buildContext: context);
                  Mirrorfly.unblockUser(profile.jid!).then((value) {
                    debugPrint(value.toString());
                    profile.isBlocked = false;
                    isBlocked(false);
                    getUnsentMessageOfAJid();
                    // Helper.hideLoading(context: context);
                    toToast('${profile.getName()} ${AppConstants.hasUnBlocked}');
                  }).catchError((error) {
                    // Helper.hideLoading();
                    debugPrint(error);
                  });
                } else {
                  toToast(AppConstants.noInternetConnection);
                }
              },
              child: Text(AppConstants.unblock.toUpperCase())),
        ],
        context: context);
  });
}