getTestDetails method

Future getTestDetails({
  1. dynamic id,
})

Implementation

Future getTestDetails({id}) async {
  var decodedResponse;
  try {
    final response = await http.get(
      Uri.parse('${WELLNESS_URL}api/diagnostic/get-tests/${id}'),
      headers: {'Authorization': currentUserToken},
    );
    decodedResponse = json.decode(response.body);
    if (decodedResponse['success'] == true) {
      TestDetails = await decodedResponse['data'][0];
      Get.back();
      Get.to(TestDescription(
        wholeData: TestDetails,
      ));
    } else {
      Get.back();
      Validator().errorMessage(
          context: commonContext, message: "${decodedResponse['message']}");
    }
  } catch (e) {
    ErrorListner(
        apiname: 'api/diagnostic/get-tests/${id}',
        responsed: "${decodedResponse}",
        request: "",
        app_error: '${e}');
  }
}