saveSelectedAddressId method

Future saveSelectedAddressId(
  1. dynamic context
)

Implementation

Future saveSelectedAddressId(context) async {
  var decodedResponse;
  final ApiBody = {"address_id": '$selectedAddressId'};
  var body = jsonEncode(ApiBody);

  http.Response response = await http.post(
      Uri.parse('${WELLNESS_URL}api/medicine/save-selected-address'),
      headers: {
        "Content-Type": "application/json",
        'Authorization': currentUserToken,
      },
      body: body);
  decodedResponse = json.decode(response.body);
  Get.back();

  if (decodedResponse['success'] == true) {
    Get.to(MedicinePlaceOrderPage());
  } else {
    Validator().errorMessage(
        context: context, message: "${decodedResponse['message']}");
  }
}