英文:
Flutter web server only accessible on localhost:8080, how to enable LAN access?
问题
问题:Flutter web不允许相同的LAN设备IP连接。
描述:本地计算机可以通过192.168.1.x:8080或localhost:8080连接到网站,但无法通过连接到LAN的另一部手机登录网页。我已经尝试了Nodejs服务器,没有这个问题。
背景环境:
操作系统:iOS
Flutter版本:3.7.0
迄今为止尝试的方法:
- 运行命令:flutter run -d web-server --web-hostname 0.0.0.0 --web-port 8080
- 关闭防火墙。
我希望他能让我在与Nodejs服务器相同的本地区域网络中访问网页。
英文:
I am a novice and I have a question I would like to ask you.
Problem:
flutter web does not allow the same LAN device ip to connect.
Description:
The local computer can connect to the website through 192.168.1.x:8080 or localhost:8080, but it cannot log in to the webpage with another mobile phone connected to the LAN. I have tried Nodejs server, and there is no such problem.
Background environment:
Operating system: IOS
flutter version: 3.7.0
Tried so far:
1. flutter run -d web-server --web-hostname 0.0.0.0 --web-port 8080
2. Firewall off.
I expect him to be able to allow me to access web pages in the same local area network as Nodejs server.
答案1
得分: -2
将本地主机名更改为您的IP地址:
flutter run -d web-server --web-hostname (在此处填写IP) --web-port 8080
如果这不起作用,请尝试这个链接:
https://medium.com/@TheOlajos/lan-cross-platform-application-using-xampp-and-flutter-markup-language-in-under-10-minutes-1b5151cc7525
英文:
Change your localhost name to your IP address:
flutter run -d web-server --web-hostname (IP here) --web-port 8080
If that doesn't work, try this:
https://medium.com/@TheOlajos/lan-cross-platform-application-using-xampp-and-flutter-markup-language-in-under-10-minutes-1b5151cc7525
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论