akinsho / flutter-tools.nvim

Tools to help create flutter apps in neovim using the native lsp
MIT License
932 stars 75 forks source link

[BUG] Debugger crashes when breakpoint exists #309

Closed paulkre closed 7 months ago

paulkre commented 7 months ago

Is there an existing issue for this?

Current Behavior

Running :lua require 'dap'.continue() with Launch Flutter will result in a crash with the following error:

Error retrieving stack traces: type 'double' is not subtype of type 'int' in type cast

(It works in VSCode)

Expected Behavior

The debugger runs correctly and stops at the breakpoint.

Steps To Reproduce

  1. Create a new project with flutter create my_app
  2. Toggle a breakpoint in the main function
  3. Run :lua require 'dap'.continue() and select Launch Flutter

Environment

- OS: macOS 14.0
- Flutter version: 3.16.0
- Is flutter in $PATH: yes
- neovim version: 0.9.2

Anything else?

No response

sidlatau commented 7 months ago

I am facing the same issue. After some investigation, I found that this is a problem with the latest Flutter version 3.16.0. Looks like at some point thread IDs became int64, while in DAP it is expected to be int32 and that breaks the debugging. I see it is already reverted with this commit https://github.com/dart-lang/sdk/commit/eda6963e4df3118bf69fda08c32743a9de1bbccb, https://github.com/dart-lang/sdk/issues/53086 But unfortunately looks like this commit was not released with the stable Flutter version. My current workaround is to use Flutter beta channel (Flutter 3.17.0-0.0.pre • channel beta), debugging works there. So closing this issue, because there is nothing we can do in this plugin to fix it.

richchurcher commented 7 months ago

Ah, I was finally getting used to being back on the stable channel! Oh well. Thanks for this, now I know I'm not going crazy.