callDoctorForPrescription method

Future callDoctorForPrescription({
  1. dynamic name,
  2. dynamic mobile_number,
  3. dynamic email_address,
  4. dynamic remark,
  5. dynamic context,
})

Implementation

Future callDoctorForPrescription(
    {name, mobile_number, email_address, remark, context}) async {
  var decodedResponse;
  final ApiBody = {
    "name": "$name",
    "mobile_no": "$mobile_number",
    "email_id": "$email_address",
    "remark": "$remark"
  };
  var body = jsonEncode(ApiBody);

  http.Response response = await http.post(
      Uri.parse('${WELLNESS_URL}api/medicine/call-doctor-request'),
      headers: {
        "Content-Type": "application/json",
        'Authorization': currentUserToken,
      },
      body: body);
  decodedResponse = json.decode(response.body);
  Get.back();

  if (decodedResponse['success'] == true) {
    Get.off(MedicineHome());

    await showDialog(
      barrierDismissible: false,
      context: context,
      builder: (BuildContext context) {
        return PinCodePopUp(
          messag: "${decodedResponse['message']}",
          image: '${LottiePath}Upload_Successful.json',
        );
      },
    );
  } else {
    Validator().errorMessage(
        context: context, message: "${decodedResponse['message']}");
  }
}