Daemon API Reference

The daemon provides a JSON-RPC 2.0 interface over stdin/stdout for real-time IDE communication. IDE extensions use this to manage SDKs, run diagnostics, and react to file system changes.

Starting the Daemon

flutter_compile daemon

The daemon communicates via newline-delimited JSON-RPC 2.0 messages on stdin (requests) and stdout (responses/notifications).

Protocol

All messages follow the JSON-RPC 2.0 specification:

Request format

{"jsonrpc": "2.0", "id": 1, "method": "sdk.list"}

Response format

{"jsonrpc": "2.0", "id": 1, "result": [...]}

Notification format (no id)

{"jsonrpc": "2.0", "method": "sdk.changed", "params": {}}

SDK Methods

sdk.list

List all installed Flutter SDK versions.

// Request
{"jsonrpc": "2.0", "id": 1, "method": "sdk.list"}

// Response
{"jsonrpc": "2.0", "id": 1, "result": [
  {"version": "3.24.0", "path": "/home/user/flutter_compile/versions/3.24.0", "global": true, "project": false},
  {"version": "3.22.3", "path": "/home/user/flutter_compile/versions/3.22.3", "global": false, "project": true},
  {"version": "stable", "path": "/home/user/flutter_compile/versions/stable", "global": false, "project": false}
]}

sdk.global.get

Get the current global default SDK version.

// Request
{"jsonrpc": "2.0", "id": 2, "method": "sdk.global.get"}

// Response
{"jsonrpc": "2.0", "id": 2, "result": {"version": "3.24.0"}}

sdk.global.set

Set the global default SDK version.

// Request
{"jsonrpc": "2.0", "id": 3, "method": "sdk.global.set", "params": {"version": "3.22.3"}}

// Response
{"jsonrpc": "2.0", "id": 3, "result": {"version": "3.22.3"}}

sdk.use.get

Get the project-pinned SDK version.

// Request
{"jsonrpc": "2.0", "id": 4, "method": "sdk.use.get", "params": {"directory": "/path/to/project"}}

// Response
{"jsonrpc": "2.0", "id": 4, "result": {"version": "3.22.3"}}

// Response (no pin)
{"jsonrpc": "2.0", "id": 4, "result": {"version": null}}

The directory parameter is optional. Defaults to the current working directory.

sdk.use.set

Pin an SDK version to a project.

// Request
{"jsonrpc": "2.0", "id": 5, "method": "sdk.use.set", "params": {"version": "3.24.0", "directory": "/path/to/project"}}

// Response
{"jsonrpc": "2.0", "id": 5, "result": {"version": "3.24.0"}}

Configuration Methods

config.list

Get all configuration key-value pairs.

// Request
{"jsonrpc": "2.0", "id": 6, "method": "config.list"}

// Response
{"jsonrpc": "2.0", "id": 6, "result": {
  "flutter_path": "~/flutter_compile/flutter/bin",
  "engine_path": "~/flutter_compile/engine",
  "global_sdk_version": "3.24.0"
}}

config.get

// Request
{"jsonrpc": "2.0", "id": 7, "method": "config.get", "params": {"key": "flutter_path"}}

// Response
{"jsonrpc": "2.0", "id": 7, "result": {"key": "flutter_path", "value": "~/flutter_compile/flutter/bin"}}

config.set

// Request
{"jsonrpc": "2.0", "id": 8, "method": "config.set", "params": {"key": "flutter_path", "value": "~/my/flutter/bin"}}

// Response
{"jsonrpc": "2.0", "id": 8, "result": {"key": "flutter_path", "value": "~/my/flutter/bin"}}

Diagnostic Methods

doctor

Run environment diagnostics.

// Request
{"jsonrpc": "2.0", "id": 9, "method": "doctor"}

// Response
{"jsonrpc": "2.0", "id": 9, "result": [
  {"name": "git", "category": "tools", "status": "ok", "path": "/usr/bin/git"},
  {"name": "python3", "category": "tools", "status": "ok", "path": "/usr/bin/python3"},
  {"name": "gclient", "category": "engine_tools", "status": "missing", "error": "not found in PATH"},
  {"name": "Flutter contributor", "category": "environments", "status": "ok"}
]}

status

Get engine configuration and available builds.

// Request
{"jsonrpc": "2.0", "id": 10, "method": "status"}

// Response
{"jsonrpc": "2.0", "id": 10, "result": {
  "configured": true,
  "engine_path": "~/flutter_compile/engine",
  "source_dir": "~/flutter_compile/engine/src",
  "source_exists": true,
  "host_cpu": "arm64",
  "builds": [
    {"name": "host_debug_unopt", "size": "4.2 GB"}
  ],
  "flutter_project": false
}}

version

// Request
{"jsonrpc": "2.0", "id": 11, "method": "version"}

// Response
{"jsonrpc": "2.0", "id": 11, "result": {"version": "0.12.0"}}

Lifecycle

shutdown

Gracefully shut down the daemon.

{"jsonrpc": "2.0", "id": 99, "method": "shutdown"}

Notifications

The daemon sends notifications (no id field) when file system changes are detected. A file watcher with 500ms debounce monitors ~/.flutter_compilerc and .flutter-version.

daemon.connected

Sent automatically when the daemon starts:

{"jsonrpc": "2.0", "method": "daemon.connected", "params": {"version": "0.12.0", "pid": 12345}}

sdk.changed

Sent when .flutter_compilerc or .flutter-version changes:

{"jsonrpc": "2.0", "method": "sdk.changed", "params": {}}

config.changed

Sent when .flutter_compilerc changes:

{"jsonrpc": "2.0", "method": "config.changed", "params": {}}

Integration Tips