skip to Main Content

I’m trying to make an http post request to save a user from a flutter app running on a real device. I’m running a Springboot RESTful API on an ubuntu server with nginx set up. A postman request is able to be sent. I have already tried adding android:usesCleartextTraffic="true" to my application tag in my android manifest and I have tried adding a network_security_config and added that to my application tag along with the meta-data tag inside the application tag.

Here is my network_security_config file:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config>
</network-security-config>

Here is my code for my flutter app calling the api:

Here is my code for my flutter app calling the api:

Here is my Springboot RESTful API code:

Here is my Springboot RESTful API code

2

Answers


  1. Chosen as BEST ANSWER

    I have figured out my issue! The issue was that I was adding android:usesCleartextTraffic="true" in the wrong android manifest file. Previously I had it under android/app/src/profile/AndroidManifest.xml but the proper spot is under andoird/app/src/debug/AndroidManifest.xml. As stated in https://flutter.dev/docs/release/breaking-changes/network-policy-ios-android


  2. You should use

    Uri.https
    

    and not

    Uri.http
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search