Flutter HTTP Request Error: ClientException with SocketException (Connection timed out) to PHP API on Local Server

When I try to send a POST request to my login API (login.php), I get the following error in Flutter:
ClientException with SocketException: Connection timed out (OS Error: Connection timed out, errno = 110), address = 192.168.51.31, port = 43832, uri=http://192.168.51.31/stray-dog//login.php

My Setup:

Flutter frontend

PHP API (login.php) hosted on local server

MySQL database

Local network Wi-Fi

API URL used: http://192.168.51.31/stray-dog//login.php

What I’ve Tried:

Confirmed that the server is running and accessible via browser from the development machine.

Verified device and server are on the same network.

Checked firewall and port blocking settings.

Tested the API using Postman from the development machine (it works).

Used emulator and real device for testing; same error occurs.

Any help or suggestions are appreciated!