How to point to localhost:8000 with the Dart http package in Flutter?

前端 未结 9 1094
野趣味
野趣味 2020-12-10 00:34

I\'m following the Flutter Networking/HTTP tutorial to do a GET request to a server running on my localhost:8000. Visiting my localhost via my browser works fine. My code lo

9条回答
  •  情歌与酒
    2020-12-10 01:10

    im using ubuntu 20LTS, laravel backend, flutter http package. first i installed a package by sudo apt install net-tools. this package supports ifconfig command to work. then from the output of ifconfig command, lookout for inet 192.168.43.217 netmask 255.255.255.0 broadcast 192.168.43.255 this line. copy inet 192.168.43.217 this ip address. from laravel project run sudo php -S 192.168.43.217:81 -t public to serve to inet address . then from flutter _apiRoute = "http://192.168.43.217:81/api/login". this worked for me.

提交回复
热议问题