SocketException: OS Error: Connection refused, errno = 111

I got this weird error when developing flutter app in windows. I have set my local apache as my API server. When I tested my API in Postman, everything is okay. Error appears when I tested API on my app with emulator.

Turn out, the problem is from emulator. Android emulator can’t communicate with or localhost. The solution is just change localhost to This IP is special alias to your host loopback interface.

You can read more about this in this docs. –>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.