I am trying to call an API in Flutter using the Dio package, but I encounter the following error when adding a token to the header:
If I remove the token, the function works correctly. The token is valid because it works with other endpoints and the endpoint in question works correctly in Postman. I have tried several solutions such as:
- Unchecking the Android Studio proxy settings
- Adding keep-alive settings
However, none of these solutions have worked. Here is the code I am using:
I have verified that:
The token is correctly formatted.
The endpoint and token work in Postman.
I have tried with and without keep-alive settings.
Could someone help me identify what might be causing this issue or suggest any other solutions?