getMedicineOrdersData method

dynamic getMedicineOrdersData(
  1. dynamic currentPage
)

Implementation

getMedicineOrdersData(currentPage) async {
  var decodedResponse;
  try {
    final response = await http.get(
      Uri.parse(
          '${medicine_API}api/medicine/order-history?page=$currentPage'),
      headers: {'Authorization': currentUserToken},
    );

    decodedResponse = json.decode(response.body);
    if (decodedResponse['success'] == true) {
      total_pages = decodedResponse['total_pages'];
      getMedicineOrdersList.addAll(await decodedResponse['data']);
    } else {}
  } catch (e) {
    ErrorListner(
        apiname: 'api/medicine/user-address-list',
        responsed: "${decodedResponse}",
        request: "",
        app_error: '${e}');
  }
}