logoutFromSDK method

dynamic logoutFromSDK(
  1. BuildContext context
)

Implementation

logoutFromSDK(BuildContext context) async {
  if (await AppUtils.isNetConnected()) {
    if (context.mounted) Helper.progressLoading(context: context);
    Mirrorfly.logoutOfChatSDK(flyCallBack: (response) {
      Helper.hideLoading(context: context);
      if (response.isSuccess) {
        clearAllPreferences();
      } else {
        Get.snackbar("Logout", "Logout Failed");
      }
    }).catchError((er) {
      Helper.hideLoading(context: context);
      SessionManagement.clear().then((value) {
        // SessionManagement.setToken(token);
        // Get.offAllNamed(Routes.login);
      });
    });
  } else {
    toToast(AppConstants.noInternetConnection);
  }
}