Answers for "flutter web access localhost"

PHP
1

flutter http localhost

- To run flutter http from localhost  if backend api is made from php then run 
`php -S 0.0.0.0:8000` 

So, this will enable you to access the localhost from the real device as:
`http://192.168.0.243:8000/api/users`

and therefore can use in flutter http requests as below after getting your
current local IP address
	var url = "http://192.168.0.25:5558/api/get-all-blog-posts";
    var response = await http.get(url); 
and be able to use localhost without uploading it to live server

- Dont forget to add     
<uses-permission android:name="android.permission.INTERNET" />
in android Manifest in flutter under android so that above can work.
Posted by: Guest on October-18-2021

Browse Popular Code Answers by Language