checkCouponValidity function

Future<CommonModel> checkCouponValidity(
  1. {required String couponsId}
)

Implementation

Future<CommonModel> checkCouponValidity({required String couponsId}) async {
  Map<String, dynamic> req = {UserKeys.userId: appStore.isLoggedIn ? appStore.userId : '', UserKeys.id: couponsId.isNotEmpty ? couponsId : ''};
  try {
    appStore.setLoading(true);
    CommonModel res = CommonModel.fromJson(await handleResponse(await buildHttpResponse('${APIEndPoint.checkCoupon}', request: req, method: HttpMethod.POST)));
    appStore.setLoading(false);
    return res;
  } catch (e) {
    toast(e.toString());
    appStore.setLoading(false);
    throw errorSomethingWentWrong;
  }
}