Skip to content

[BUG] FlutterToolsAppStarted never fires when running with the debugger (DAP event name mismatch) #563

Closed

Description

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When the app runs through the debugger runner (debugger.enabled = true), the FlutterToolsAppStarted User event is never emitted. Autocmds listening for it never run, and the statusline decorations in decorations.lua are not refreshed on app start.

debugger_runner.lua listens for a DAP event named app.started (lines 187 and 238):

{ "before", "event_app.started" },
dap.listeners.before["event_app.started"][plugin_identifier] = function(_, _)

Flutter's debug adapter never sends a DAP event with that name. app.started is the event flutter run --machine emits. The adapter receives it internally (handleJsonEvent in flutter_adapter.dart) and forwards it to the DAP client as flutter.appStarted:

// packages/flutter_tools/lib/src/debug_adapters/flutter_adapter.dart
sendEvent(RawEventBody(<String, Object?>{}), eventType: 'flutter.appStarted');

Expected Behavior

FlutterToolsAppStarted fires once the app is running, the same as with the job runner.

Steps To Reproduce

  1. Save this as repro.lua:
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    {
      "nvim-flutter/flutter-tools.nvim",
      dependencies = { "nvim-lua/plenary.nvim", "mfussenegger/nvim-dap" },
      config = function()
        require("flutter-tools").setup({ debugger = { enabled = true } })
        vim.api.nvim_create_autocmd("User", {
          pattern = "FlutterToolsAppStarted",
          callback = function() print("FlutterToolsAppStarted fired") end,
        })
        require("dap").listeners.before["event_flutter.appStarted"]["repro"] = function()
          print("DAP event flutter.appStarted received")
        end
      end,
    },
  },
})
  1. In a Flutter project, run nvim -u repro.lua lib/main.dart.
  2. Run :FlutterRun and wait until the app is running on the device.
  3. Check :messages. DAP event flutter.appStarted received is printed, but FlutterToolsAppStarted fired is not.

Environment

- OS: macOS 26.7.2
- Device: macOS desktop (-d macos), fresh flutter create app
- Flutter version: 3.41.9
- Is flutter in $PATH: yes
- neovim version: 0.13.0-dev
- flutter-tools.nvim: latest `main` (8b139a8)

Anything else?

Suggested fix: change event_app.started to event_flutter.appStarted in both places in lua/flutter-tools/runners/debugger_runner.lua. With that change applied, the repro above prints FlutterToolsAppStarted fired right after the DAP event.
I can open a PR.

Activity

  1. sidlatau commented on Oct 30, 2026

    @sidlatau
    Collaborator

    Thanks for the detailed report and the repro, the analysis was spot on. Since the fix is a two-line rename, I went ahead and opened #564 with your suggested change and a test for it.

    The same listener also sets the "app started" flag that clears the pre-start log buffer, so besides the missing FlutterToolsAppStarted event, debugger sessions were keeping their whole output in that buffer until exit. The fix covers that too.

  2. added a commit that references this issue on Oct 30, 2026
    0ef43df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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