Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Isar Inspector connection fails with Connection refused on Flutter 3.32.8 (macOS, Android real device) #131

@yuxiaos1132

Description

@yuxiaos1132

Description

The Isar Inspector fails to connect when running an app on a physical Android device. The flutter run command prints the "ISAR CONNECT STARTED" message, suggesting the local proxy server has started. However, the web UI fails to connect, and direct connection tests on the host machine confirm that nothing is listening on the specified port, resulting in a Connection refused error.

This strongly suggests the local proxy server is crashing silently or failing to bind correctly, likely due to a compatibility issue with the latest Flutter 3.32.8 release.

Steps to Reproduce

  1. Create a new Flutter project and add the Isar dependencies as shown in the code sample below.
  2. Use the provided main.dart code, which enables the inspector.
  3. Run the app on a physical Android device using flutter run.
  4. The console will print the Isar Inspector URL (e.g., https://inspect.isar-community.dev/3.1.8/#/<port>/<auth> ).
  5. Open this URL in a browser.
  6. Expected: The Inspector connects.
  7. Actual: The Inspector UI hangs on "Connecting...", and the browser's developer console shows a WebSocket connection error: main.dart.js:8029 WebSocket connection to 'ws://127.0.0.1:<port>/...' failed:.
  8. On the host machine (macOS), running websocat -v ws://127.0.0.1:<port> fails with Connection refused (os error 61).

Code sample

pubspec.yaml:

# Using YAML anchors for version consistency, as seen in the user's project.
isar_version: &isar_version 3.1.8

dependencies:
  flutter:
    sdk: flutter
  path_provider: ^2.0.11 # Required for Isar initialization
  isar: 
    version: *isar_version
    hosted: https://pub.isar-community.dev/
  isar_flutter_libs:
    version: *isar_version
    hosted: https://pub.isar-community.dev/

dev_dependencies:
  flutter_test:
    sdk: flutter
  isar_generator: 
    version: *isar_version
    hosted: https://pub.isar-community.dev/
  build_runner: any

lib/main.dart (Simplified from user's project for reproducibility):

import 'package:flutter/material.dart';
import 'package:isar/isar.dart';
import 'package:path_provider/path_provider.dart';

// A simple schema is required to open Isar
@collection
class DummySchema {
  Id id = Isar.autoIncrement;
}

// This service class mirrors the user's project structure
// where Isar is initialized and held.
class DatabaseService {
  late final Future<Isar> _isar;

  DatabaseService() {
    _isar = _init();
  }

  Future<Isar> get isar => _isar;

  Future<Isar> _init() async {
    final dir = await getApplicationDocumentsDirectory();
    // The inspector is enabled here, which is the key part.
    return Isar.open(
      [DummySchemaSchema],
      directory: dir.path,
      inspector: true,
    );
  }
}

final DatabaseService _databaseService = DatabaseService();

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  // Initialize the database before running the app
  await _databaseService.isar;

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: Center(
          child: Text('Isar Inspector Test on Flutter 3.32.8'),
        ),
      ),
    );
  }
}

Details

  • Platform:
    • Host: macOS 15.5
    • Target Device: Xiaomi 13 (Model 2211133C), running Android
  • Flutter version: 3.32.8
  • Isar version:
    • isar: 3.1.8
    • isar_flutter_libs: 3.1.8
    • isar_generator: 3.1.8

  • I searched for similar issues already
  • I filled the details section with the exact device model and version
  • I am able to provide a reproducible example

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions