When i run dap continue, debugger starts but soon after it closes itself after asking to specify device.
So i was wondering what is best solution to this and can i specify -d flag and maybe hardcode chrome?
Here is my code so far:
return {
"akinsho/flutter-tools.nvim",
dependencies = { "nvim-lua/plenary.nvim", "stevearc/dressing.nvim" },
lazy = false,
config = function()
local fltools = require("flutter-tools")
fltools.setup({
lsp = {
settings = {
linelength = vim.o.textwidth,
}
},
debugger = {
enabled = true,
run_via_dap = true,
register_configurations = function(_)
local dap = require("dap")
dap.adapters.dart = {
type = "executable",
command = vim.fn.stdpath("data") .. "/mason/bin/dart-debug-adapter",
args = { "flutter" }
}
dap.configurations.dart = {
{
type = "dart",
request = "launch",
name = "launch flutter",
dartsdkpath = '/users/herculepoirot/flutter/bin/cache/dart-sdk/',
fluttersdkpath = "/users/herculepoirot/flutter",
program = "${workspacefolder}/lib/main_dev.dart",
cwd = "${workspacefolder}",
device = "chrome",
}
}
end,
},
})
fltools.setup_project({
{
name = 'web',
device = 'chrome',
target = "lib/main_dev.dart",
flutter_mode = "debug",
},
{
name = 'mac',
device = 'mac',
target = "lib/main_dev.dart",
flutter_mode = "debug",
}
})
end
}
You can add toolArgs = {"-d","chrome"}
in dap.configuration.dart table.
dap.configurations.dart = {
{
type = "dart",
request = "launch",
name = "launch flutter",
dartsdkpath = '/users/herculepoirot/flutter/bin/cache/dart-sdk/',
fluttersdkpath = "/users/herculepoirot/flutter",
program = "${workspacefolder}/lib/main_dev.dart",
cwd = "${workspacefolder}",
device = "chrome",
toolArgs = {"-d","chrome"}
}
}