DeletePrescription method

Future DeletePrescription({
  1. dynamic prescription_id,
})

Implementation

Future DeletePrescription({prescription_id}) async {
  var decodedResponse;
  final ApiBody = {
    "prescription_id": '${prescription_id}',
  };

  try {
    final response = await http.post(
        Uri.parse(
            '${WELLNESS_URL}api/diagnostic/delete-uploaded-prescription'),
        body: ApiBody,
        headers: {"Authorization": currentUserToken});
    decodedResponse = json.decode(response.body);

    if (decodedResponse['success'] == true) {
      Validator().successMessage(
          context: commonContext, message: "${decodedResponse['message']}");
    }
  } catch (e) {
    print(e);

    ErrorListner(
        apiname: 'api/diagnostic/delete-uploaded-prescription',
        responsed: "${decodedResponse}",
        request: "",
        app_error: '${e}');
  }
}