testOrderList method

Future testOrderList(
  1. dynamic currentPage
)

Implementation

Future testOrderList(currentPage) async {
  var decodedResponse;
  try {
    final response = await http.get(
      Uri.parse('${medicine_API}api/diagnostic/order-list?page=$currentPage'),
      headers: {'Authorization': currentUserToken},
    );
    decodedResponse = json.decode(response.body);

    if (decodedResponse['success'] == true) {
      total_pages = decodedResponse['total_pages'];
      TestOrderList.addAll(await decodedResponse['response']);
    } else {
      Get.back();
    }
  } catch (e) {
    ErrorListner(
        apiname: 'api/diagnostic/order-list',
        responsed: "${decodedResponse}",
        request: "",
        app_error: '${e}');
  }
}