【问题标题】:Appwrite with Flutter [Connection refused]Appwrite 与 Flutter [连接被拒绝]
【发布时间】:2020-12-08 10:18:01
【问题描述】:

我刚刚尝试了 Flutter 的 appwrite 平台,但是在我尝试过任何请求之后都会发生这种情况。

服务器在http://localhost:300(或https://localhost:301)初始化,endpoint = http://localhost:300/ v1

static Future<void> init() async {
  _client = Client();
  _client.setEndpoint("http://localhost:300/v1").setProject('5fccf1924cbf5').setSelfSigned();
  _db = Database(_client);
}
E/flutter (28886): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: DioError [DioErrorType.DEFAULT]: SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 47194
E/flutter (28886): #0      DioMixin._request._errorInterceptorWrapper.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:dio/src/dio.dart:870:17)

目前仅在 Android(物理设备)上试用。

【问题讨论】:

    标签: flutter-dependencies flutter-android appwrite


    【解决方案1】:

    这是网络错误。您应该在 Appwrite SDK 客户端中将您的私有 IP 而不是 localhost 设置为 Appwrite 主机名,或者使用像 ngrok 这样的服务来代理 Appwrite API。

    当尝试从模拟器或设备连接时,localhost 是设备或模拟器的主机名。

    另一个测试您是否使用正确主机名的好方法是检查您是否可以从您的设备/模拟器浏览器访问 Appwrite 控制台。

    【讨论】:

      猜你喜欢
      • 2017-08-08
      • 1970-01-01
      • 2023-03-21
      • 1970-01-01
      • 2022-01-07
      • 2020-06-21
      • 2016-05-28
      • 2015-06-02
      • 2018-08-20
      相关资源
      最近更新 更多