Skip to content

fix(dev_tools): prevent nil data error on app termination - #528

Open
zanadoman wants to merge 1 commit into
nvim-flutter:mainfrom
zanadoman:main
Open

fix(dev_tools): prevent nil data error on app termination#528
zanadoman wants to merge 1 commit into
nvim-flutter:mainfrom
zanadoman:main

Conversation

@zanadoman

@zanadoman zanadoman commented Jul 28, 2026

Copy link
Copy Markdown

Fixed strange error messages after terminating the application while using dev tools in browser.

Plugin configuration:

if vim.fn.exepath "flutter" ~= "" then
    vim.pack.add {
        "https://github.com/nvim-lua/plenary.nvim",
        "https://github.com/mfussenegger/nvim-dap",
        "https://github.com/zanadoman/flutter-tools.nvim"
    }
    require "flutter-tools".setup { dev_log = { enabled = false }, dev_tools = { autostart = true, auto_open_browser = true } }
end

Steps to reproduce

  • Open lib/main.dart
  • Launch app with FlutterRun
  • Close app
vim.schedule callback: ...e/opt/flutter-tools.nvim/lua/flutter-tools/dev_tools.lua:131: attempt to get length of local 'data' (a nil value) stack traceback:
        ...e/opt/flutter-tools.nvim/lua/flutter-tools/dev_tools.lua:131: in function 'fn'
        [string "vim/_core/editor"]:273: in function <[string "vim/_core/editor"]:272>

I added the missing nil checks to bypass the errors, now 'Dev tools closed' message appears after closing the app without any issue. If you have a more elegant solution to solve this issue please modify my solution. :)

Thank you for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant