Scope
flutter run --machine reliably emits the VM Service URI via the app.debugPort JSON-RPC event, but it does not always print a human-readable DevTools URL line. Today open_devtools_all and the log-line capture path depend entirely on seeing app.devTools: <url> in the Flutter output. When that line never arrives, the d keybind reports:
[emulator] DevTools not ready yet — still building / VM Service not up
No DevTools URL captured yet — wait for the app to start and retry
…even though memory polling, network polling, and the VM Service itself are all healthy.
Reproduced on Android emulator (API 36) with flutter run --machine -t lib/main.dart --flavor staging. The log shows VM Service ready and successful getVM responses, but devtools_uri on the DeviceSession stays None indefinitely.
Root cause
-
DeviceSession::devtools_uri is only populated from a strip_prefix("app.devTools: ") match inside the event loop. In --machine mode Flutter often skips the human-readable DevTools log line entirely — the URL only exists as a structured daemon response or can be synthesised from the VM Service URI + a running DevTools server.
-
open_devtools_all has no fallback — if devtools_uri is None it emits the warning and gives up.
What to do
- Store the VM Service URI from
AppStarted / app.debugPort on DeviceSession (new vm_service_uri slot).
- After
AppStarted, probe for an already-running local DevTools server (ports 9100–9199) and synthesise the full http://<host>:<port>/?uri=<encoded-vm-uri> URL.
- If no server is found yet, send
devtools.serve to the Flutter daemon — parse the {"result":{"host":"…","port":…}} response in parse_daemon_line and build the URL from that.
- Give
open_devtools_all a last-resort probe so pressing d later still works even if the startup window was missed.
- Also capture the human-readable
"Flutter DevTools … is available at: <url>" form for non-machine-mode edge cases.
Acceptance
Scope
flutter run --machinereliably emits the VM Service URI via theapp.debugPortJSON-RPC event, but it does not always print a human-readable DevTools URL line. Todayopen_devtools_alland the log-line capture path depend entirely on seeingapp.devTools: <url>in the Flutter output. When that line never arrives, thedkeybind reports:…even though memory polling, network polling, and the VM Service itself are all healthy.
Reproduced on Android emulator (API 36) with
flutter run --machine -t lib/main.dart --flavor staging. The log showsVM Service readyand successfulgetVMresponses, butdevtools_urion theDeviceSessionstaysNoneindefinitely.Root cause
DeviceSession::devtools_uriis only populated from astrip_prefix("app.devTools: ")match inside the event loop. In--machinemode Flutter often skips the human-readable DevTools log line entirely — the URL only exists as a structured daemon response or can be synthesised from the VM Service URI + a running DevTools server.open_devtools_allhas no fallback — ifdevtools_uriisNoneit emits the warning and gives up.What to do
AppStarted/app.debugPortonDeviceSession(newvm_service_urislot).AppStarted, probe for an already-running local DevTools server (ports 9100–9199) and synthesise the fullhttp://<host>:<port>/?uri=<encoded-vm-uri>URL.devtools.serveto the Flutter daemon — parse the{"result":{"host":"…","port":…}}response inparse_daemon_lineand build the URL from that.open_devtools_alla last-resort probe so pressingdlater still works even if the startup window was missed."Flutter DevTools … is available at: <url>"form for non-machine-mode edge cases.Acceptance
VM Service ready,dopens DevTools in the browser without the "not ready" warning.urlis already a workspace dependency.cargo test --workspace --lockedstays green.