TestOrderViewDetails method

Future TestOrderViewDetails({
  1. dynamic order_id,
  2. dynamic apiReload,
})

Implementation

Future TestOrderViewDetails({order_id, apiReload}) async {
  CancelReasonList.clear();
  var decodedResponse;
  try {
    final response = await http.get(
      Uri.parse('${medicine_API}api/diagnostic/order-details/${order_id}'),
      headers: {'Authorization': currentUserToken},
    );
    decodedResponse = json.decode(response.body);
    print(response.request);
    if (decodedResponse['success'] == true) {
      Get.back();
      TestviewDetails = await decodedResponse['response'];
      CancelReasonList = await decodedResponse['cancellation_reason_list'];
      CancelReasonList.add({"label": "Other", "value": "Other"});
      Get.to(DiagnosticsOrderDetails(apiReload: apiReload),
          transition: Transition.noTransition);
    } else {
      Get.back();
    }
  } catch (e) {
    print(e);
    ErrorListner(
        apiname: 'api/diagnostic/order-details/${order_id}',
        responsed: "${decodedResponse}",
        request: "",
        app_error: '${e}');
  }
}