wellnessWingsSubmission method

Future wellnessWingsSubmission({
  1. dynamic requestType,
  2. dynamic name,
  3. dynamic mobileNumber,
  4. dynamic email,
  5. dynamic message,
  6. 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}');
  }
}