getMedicineDetails method

Future getMedicineDetails({
  1. dynamic skuId,
  2. dynamic medicineType,
})

Implementation

Future getMedicineDetails({
  skuId,
  medicineType,
}) async {
  var decodedResponse;

  try {
    final response = await http.get(
      Uri.parse(
          '${WELLNESS_URL}api/medicine/medicine-details?sku_id=$skuId&type=$medicineType&pincode=${enteredPincode.value}'),
      headers: {'Authorization': currentUserToken},
    );

    decodedResponse = json.decode(response.body);

    if (decodedResponse['success'] == true) {
      getMedicineDetailsData = await decodedResponse['data'];
    } else {
      Get.back();
      Validator().errorMessage(
          context: commonContext, message: decodedResponse['message']);
    }
  } catch (e) {
    ErrorListner(
        apiname:
            'api/medicine/medicine-details?sku_id=$skuId&type=$medicineType&pincode=${enteredPincode.value}',
        responsed: "${decodedResponse}",
        request: "",
        app_error: '${e}');
  }
}