getCategoryDetails method

Future getCategoryDetails({
  1. dynamic id,
})

Implementation

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