Appwrite with Flutter [Connection refused]


I just tried appwrite platform for Flutter, but this happened after any request I tried.

The server is initialized at http://localhost:300 (or https://localhost:301), endpoint = http://localhost:300/v1

static Future<void> init() async {
  _client = Client();
  _db = Database(_client);
E/flutter (28886): [ERROR:flutter/lib/ui/] 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)

Only tried on Android (physical device) for now.


This is a network error. You should set your private IP instead of localhost as the Appwrite hostname in your Appwrite SDK client or use a service like ngrok to proxy the Appwrite API.

When trying to connect from an emulator or a device localhost is the hostname for the device or emulator.

Another good method to test that you’re using the correct hostname is to check if you can access the Appwrite console from your device/emulator browser.

Answered By – eldadfux

Answer Checked By – Marilyn (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *