CallFucntion method

dynamic CallFucntion({
  1. dynamic requestType,
  2. dynamic context,
})

Implementation

CallFucntion({requestType, context}) async {
  await AccountController.getUserDetails();
  final apibody = {
    "support_request_no": AccountController.profileMobile.toString(),
    "support_request_type": requestType
  };
  var decodedResponse;
  try {
    http.Response response = await http.post(
        Uri.parse('${SDK_BASE_URL}wellness_api/general_request_support'),
        body: apibody);
    decodedResponse = json.decode(response.body);

    if (decodedResponse['status'] == 200) {
      Get.back();
      await showDialog(
          context: context,
          barrierDismissible: false,
          builder: (BuildContext context) {
            return PinCodePopUp(
              messag: decodedResponse['message'].toString(),
              image: '${LottiePath}Upload_Successful.json',
            );
          });
      await Get.offAll(HomePage());
    }
  } catch (e) {
    errorListner(
        apiname: 'wellness_api/general_request_support',
        app_error: '${e}',
        request: '${apibody}',
        responsed: "${decodedResponse}");
  }
}