medicineAddAdress method
Future
medicineAddAdress({
- dynamic addresstype,
- dynamic name,
- dynamic mobile,
- dynamic email,
- dynamic address,
- dynamic landmark,
- dynamic city,
- dynamic state,
- dynamic pincode,
- dynamic addressAction,
- dynamic context,
Implementation
Future medicineAddAdress(
{addresstype,
name,
mobile,
email,
address,
landmark,
city,
state,
pincode,
addressAction,
context}) async {
var decodedResponse;
final ApiBody = {
"address_id": addressAction,
"name": "${name}",
"mobile_no": "${mobile}",
"email_id": "${email}",
"type": "${addresstype}",
"address": "${address}",
"landmark": "${landmark}",
"pincode": pincode,
"city": "${city}",
"state": "${state}"
};
try {
Map data = ApiBody;
var body = jsonEncode(data);
final response = await http.post(
Uri.parse('${WELLNESS_URL}api/medicine/store-user-address'),
headers: {
'Authorization': currentUserToken,
"Content-Type": "application/json",
},
body: body,
);
decodedResponse = json.decode(response.body);
Get.back();
if (decodedResponse['success'] == true) {
Get.to(MedicineAddressListPage());
Validator().successMessage(
context: context, message: "${decodedResponse['message']}");
}
} catch (e) {
ErrorListner(
apiname: 'api/medicine/store-user-address',
responsed: "${decodedResponse}",
request: "${ApiBody}",
app_error: '${e}');
}
}