BookDentail method

Future BookDentail({
  1. dynamic deptid,
  2. dynamic patientname,
  3. dynamic age,
  4. dynamic gender,
  5. dynamic visitdate,
  6. dynamic visittime,
  7. dynamic mobilenumber,
  8. dynamic emailid,
})

Implementation

Future BookDentail(
    {deptid,
    patientname,
    age,
    gender,
    visitdate,
    visittime,
    mobilenumber,
    emailid}) async {
  final ApiBody = {
    "dept_id": deptid.toString(),
    "patient_name": patientname,
    "patient_age": age.toString(),
    "gender": gender,
    "visit_date": visitdate.toString(),
    "visit_time": visittime.toString(),
    "mobile_number": mobilenumber.toString(),
    "email_id": emailid
  };
  var decodedResponse;

  try {
    final response = await http.post(
        Uri.parse('${SDK_BASE_URL}dental_api/book'),
        body: ApiBody,
        headers: {"Authorization": SignUpController.currentUserToken});
    decodedResponse = json.decode(response.body);
    bookdetails.value = decodedResponse;
    if (response.statusCode == 200) {
      Get.to(PreviewConfirmation(),
          duration: Duration(milliseconds: 500),
          transition: Transition.cupertinoDialog);
    }
  } catch (e) {
    errorListner(
        apiname: 'dental_api/book',
        responsed: "${decodedResponse}",
        request: '${ApiBody}',
        app_error: '${e}');
  }
}