removeProfileImage method

dynamic removeProfileImage(
  1. BuildContext context
)

Implementation

removeProfileImage(BuildContext context) async {
  if(await AppUtils.isNetConnected()) {
    if(context.mounted)showLoader(context);
    loading.value = true;
    Mirrorfly.removeProfileImage().then((value) {
      loading.value = false;
      hideLoader(context);
      if (value != null) {
        SessionManagement.setUserImage(Constants.emptyString);
        isImageSelected.value = false;
        isUserProfileRemoved.value = true;
        userImgUrl(Constants.emptyString);
        /*if (from.value == Routes.login) {
          changed(true);
        } else {*/
          save(frmImage: true, context: context);
        // }
        update();
      }
    }).catchError((onError) {
      loading.value = false;
      hideLoader(context);
    });
  }else{
    toToast(AppConstants.noInternetConnection);
  }
}