我开始将我的 Flutter 应用程序移植到macos Desktop。用户界面开始很好。但是,一旦应用程序进行网络调用,它就会立即失败,并显示Connection failed (OS Error: Operation not allowed)。
运行单线:
final response = await http.get('https://jsonplaceholder.typicode.com/posts/1');
失败:
Unhandled Exception: SocketException: Connection failed (OS Error:
Operation not permitted, errno = 1),
address = jsonplaceholder.typicode.com, port = 443
#0 IOClient.send (package:http/src/io_client.dart:33:23)
macos 构建目标来自 Google 的示例here。
Flutter (Channel master, v1.9.8-pre.108)