addToWishList function

Future<bool> addToWishList(
  1. {required int id,
  2. bool isListing = false}
)

Implementation

Future<bool> addToWishList({required int id, bool isListing = false}) async {
  appStore.setFavLoading(true);

  Map req = {"ref_id": id, "user_id": appStore.userId, "type": isListing ? "listing" : "event"};
  return await addWishList(req).then((res) {
    toast(res.message);
    appStore.setFavLoading(false);

    return true;
  }).catchError((error) {
    toast(error.toString());
    appStore.setFavLoading(false);

    return false;
  });
}