Fairly new to Flutter and have encountered an issue. I am trying to get the emulator (for both iOS and Android) of my app to connect to an API that is running on my local machine. I had it working up until I upgraded flutter null-safety and have not been able to get it back since. Any suggestions on how I can fix the error I am getting?
The error is clear about that - you are trying to access the URI without a host. The line with the URI path looks like nullapi/auth/login/
I assume it should not start from null
.
The part of the code you provided us with in question is not clear regarding the error because the error clearly appears when you try to call api/auth/login/
but there is nothing regarding this call in the code you provided.
The issue is that your apiURL
is null. At which point it becomes null - that I don't know - the code in question is not enough to figure it out. I would suggest you debug the whole data flow - from parsing to the actual call, and, I am sure of it, you will be able to find the issue.