saveTimeSlot method

Future saveTimeSlot(
  1. dynamic context
)

Implementation

Future saveTimeSlot(context) async {
  var decodedResponse;
  final ApiBody = {"date": "${SelectedDate}", "time": "${SelectedTime}"};
  var body = jsonEncode(ApiBody);

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

  if (decodedResponse['success'] == true) {
    await PlaceOrderDetailsFunction(
        context: context, package_id: '', wallet_id: '');
    Get.to(TestPlaceOrder());
  } else {
    Validator().errorMessage(
        context: context, message: "${decodedResponse['message']}");
  }
}