BookAppointment method

Future BookAppointment({
  1. dynamic bookid,
  2. dynamic deptid,
  3. dynamic mbprice,
  4. dynamic type,
  5. dynamic userid,
  6. dynamic patientname,
  7. dynamic patientage,
  8. dynamic appointmentdate,
  9. dynamic gender,
  10. dynamic mobilenumber,
  11. dynamic emailid,
  12. dynamic checkbox,
  13. dynamic appointment_time,
})

Implementation

Future BookAppointment(
    {bookid,
    deptid,
    mbprice,
    type,
    userid,
    patientname,
    patientage,
    appointmentdate,
    gender,
    mobilenumber,
    emailid,
    checkbox,
    appointment_time}) async {
  final ApiBody = {
    "otp_verify": "1",
    "bookid": "${bookid}",
    "dept_id": "${deptid}",
    "mb_price": "${mbprice}",
    "mb_consult_type": type,
    "user_id": "${userid}",
    "patient_name": patientname,
    "patient_age": "${patientage}",
    "appointment_date": appointmentdate,
    "appointment_time": appointment_time == null ? "" : appointment_time,
    "gender": gender,
    "mobile_number": "${mobilenumber}",
    "email_id": emailid,
    "check_use_wallet": "${checkbox}",
  };
  var decodedResponse;
  try {
    final response = await http.post(
        Uri.parse('${SDK_BASE_URL}teleconsultation_api/book'),
        body: ApiBody,
        headers: {
          "Authorization": SignUpController.currentUserToken,
        });
    decodedResponse = json.decode(response.body);

    Get.back();
    if (response.statusCode == 200) {
      Get.back();
    }
    return decodedResponse;
  } catch (e) {
    errorListner(
        apiname: 'teleconsultation_api/book',
        responsed: "${decodedResponse}",
        request: "${ApiBody}",
        app_error: '${e}');
  }
}