TestorderPreview method

Future TestorderPreview({
  1. dynamic otpverify,
  2. dynamic city_valid,
  3. dynamic checkbox,
  4. dynamic emailid,
  5. dynamic address,
  6. dynamic landmark,
  7. dynamic pincode,
  8. dynamic city,
  9. dynamic visitdate,
  10. dynamic visittime,
  11. dynamic pkhtestdataarray,
  12. dynamic userpackageId,
})

Implementation

Future TestorderPreview(
    {otpverify,
    city_valid,
    checkbox,
    emailid,
    address,
    landmark,
    pincode,
    city,
    visitdate,
    visittime,
    pkhtestdataarray,
    userpackageId}) async {
  var body;
  var decodedResponse;
  try {
    Map data = {
      "user_data": {
        "otp_verify": "${otpverify}",
        "city_valid": "${city_valid}",
        "email_id": "${emailid}",
        "address": "${address}",
        "landmark": "${landmark}",
        "pincode": "${pincode}",
        "city": "${city}",
        "visit_date": "${visitdate}",
        "visit_time": "${visittime}",
      },
      "package_data": pkhtestdataarray,
      "check_use_wallet": "${checkbox}",
      "user_package_id": "${userpackageId}",
    };
    body = jsonEncode(data);
    final response = await http.post(
      Uri.parse('${SDK_BASE_URL}diagnostics_api/preview_order'),
      headers: {'Authorization': SignUpController.currentUserToken},
      body: body,
    );
    decodedResponse = json.decode(response.body);
    Testorderid = await decodedResponse['data']['insert_id'];
    TestPreviewDetails = await decodedResponse;
  } catch (e) {
    errorListner(
        apiname: 'diagnostics_api/preview_order',
        responsed: "${decodedResponse}",
        request: '${body}',
        app_error: '${e}');
  }
}