wellnessWingsSubmission method
Future
wellnessWingsSubmission({
- dynamic requestType,
- dynamic name,
- dynamic mobileNumber,
- dynamic email,
- dynamic message,
- dynamic context,
Implementation
Future wellnessWingsSubmission(
{requestType, name, mobileNumber, email, message, context}) async {
var decodedResponse;
final ApiBody = {
"type": "$requestType",
"name": "$name",
"mobile_number": "$mobileNumber",
"email_id": "$email",
"message": "$message"
};
try {
Map data = ApiBody;
var body = jsonEncode(data);
final response = await http.post(
Uri.parse('${medicine_API}api/save-wellness-wings-details'),
headers: {
'Authorization': currentUserToken,
"Content-Type": "application/json",
},
body: body,
);
decodedResponse = json.decode(response.body);
Get.back();
if (decodedResponse['success'] == true) {
// Get.offAll(HomePage());
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return PinCodePopUp(
messag: "${decodedResponse['message']}",
image: '${LottiePath}Upload_Successful.json',
);
});
} else {
Validator().errorMessage(
context: context, message: "${decodedResponse['message']}");
}
} catch (e) {
ErrorListner(
apiname: 'api/save-wellness-wings-details',
responsed: "${decodedResponse}",
request: "${ApiBody}",
app_error: '${e}');
}
}