SelectTime method

dynamic SelectTime({
  1. dynamic hospitalId,
  2. dynamic doctorId,
  3. dynamic day,
  4. dynamic date,
})

Implementation

SelectTime({hospitalId, doctorId, day, date}) async {
  var decodedResponse;
  final ApiBody = {
    "doctor_id": doctorId.toString(),
    "hospital_id": hospitalId.toString(),
    "day": day,
    "date": date.toString(),
  };
  try {
    http.Response response = await http.post(
        Uri.parse('${SDK_BASE_URL}doctor_api/appointment_timeslot'),
        headers: {
          "Authorization": SignUpController.currentUserToken,
        },
        body: ApiBody);
    decodedResponse = json.decode(response.body);
    morningtime = decodedResponse['details']['monring'];
    afternoontime = decodedResponse['details']['afternoon'];
    eveningtime = decodedResponse['details']['evening'];
    timelist = morningtime + afternoontime + eveningtime;
    return timelist;
  } catch (e) {
    errorListner(
        apiname: 'doctor_api/appointment_timeslot',
        responsed: "${decodedResponse}",
        request: '${ApiBody}',
        app_error: '${e}');
  }
}