如何在Flutter应用程序的Wi-fi设置中使用代理?

发布于 2025-01-19 09:15:35 字数 255 浏览 2 评论 0 原文

案件: 我使用Flutter创建一个应用程序,该应用程序将调用Restful Api到后端服务器来获取数据。 但是,出于安全原因,后端服务器仅向选定的主机和端口开放。 如果该应用程序在该网络下则可以正常运行,但如果在该网络下则无法正常运行,因为无法获取数据。 因此,我想为我正在使用的 wi-fi 设置代理,并正常运行应用程序。 不幸的是,flutter 应用程序仍然无法在 Android 和 IOS 平台上运行。

问题: 如何在Flutter应用程序的Wi-fi设置中使用代理?

Case:
I use Flutter to create an app, and the app will call Restful Api to backend server to get data.
However, the backend server only open to a selected host and port for security reason.
The app works well if it is under that network, but cannot works properly because of fail to get data if out of that network.
As a result, I would like to setup a proxy for the wi-fi I'm using, and run the app as normal.
Unfortunately, the flutter app still not working in both Android and IOS platform.

Question:
How to use proxy in Wi-fi setting for the app in Flutter app?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

口干舌燥 2025-01-26 09:15:35

您可以尝试使用此软件包应用系统的全局代理设置: https://pab.dev/packages/packages/native_flutter_proxy

DART的网络工具不会自行访问这些设置。

You may try using this package to apply the system's global proxy settings: https://pub.dev/packages/native_flutter_proxy

Dart's networking tools don't pick up these settings on their own.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文