getRecentOrderedMedicine method

Future getRecentOrderedMedicine({
  1. dynamic current_page,
})

Implementation

Future getRecentOrderedMedicine({current_page}) async {
  var decodedResponse;

  try {
    final response = await http.get(
      Uri.parse(
          '${medicine_API}api/medicine/previous-ordered-list?pincode=${enteredPincode.value}&page=$current_page'),
      headers: {'Authorization': currentUserToken},
    );

    decodedResponse = json.decode(response.body);
    total_pages = decodedResponse['total_pages'];
    getRecentMedicineList.addAll(await decodedResponse['data']);
  } catch (e) {
    ErrorListner(
        apiname:
            'api/medicine/previous-ordered-list?pincode=${enteredPincode.value}&page=$current_page',
        responsed: "${decodedResponse}",
        request: "",
        app_error: '${e}');
  }
}