getMedicineList method

Future getMedicineList({
  1. dynamic medicineName,
})

Implementation

Future getMedicineList({medicineName}) async {
  var decodedResponse;

  try {
    final response = await http.get(
      Uri.parse(
          '${WELLNESS_URL}api/medicine/medicine-list?medicine_name=$medicineName&pincode=${enteredPincode.value == '' ? '400001' : enteredPincode.value}'),
      headers: {'Authorization': currentUserToken},
    );
    decodedResponse = json.decode(response.body);
    if (decodedResponse['success'] == true) {
      getMedicineData = await decodedResponse['data'];
    } else {
      return null;
    }
  } catch (e) {
    ErrorListner(
        apiname:
            'api/medicine/medicine-list?pincode=${enteredPincode.value}&medicine_name=$medicineName',
        responsed: "${decodedResponse}",
        request: "",
        app_error: '${e}');
  }
}