flutter-tools.nvim
flutter-tools.nvim copied to clipboard
[Bug]: dart:developer logs are not showing up in the dev log
Describe the bug
While running Flutter applications, logs using log()
from dart:developer
are not showing up in the dev log.
My configuration:
require('flutter-tools').setup{
dev_log = {
enabled = true,
open_cmd = "tabedit"
},
dev_tools = {
autostart = true
},
--debugger = {
--enabled = true,
--run_via_dap = true,
--register_configurations = function(_)
--require("dap").configurations.dart = {}
--require("dap.ext.vscode").load_launchjs()
--end,
--}
}
The issue is there, whether or not the debugger is enabled or run_via_dap is set to true.
To Reproduce Steps to reproduce the behavior:
- Create a new flutter project(default counter app)
- Use the
log()
method fromdart:developer
to log something( maybe log the value of_counter
in the_incrementCounter()
method.
Expected behavior The log should show up in the dev log.
System information
- OS: Manjaro Linux
- Flutter version: 2.8.1
- Is flutter in $PATH: Yes
- neovim version: v0.7.0-dev+994-g5be2cdd91
Additional context According to #3653 on the Dart-Code repo these logs only work while debugging.
Thank you for this awesome plugin :smile:
@akinsho Sorry to bug you. I understand that you might have a lot of things on your plate :sweat_smile: . May I get a little help here? I really want this to work if it's possible :grimacing:
@Thesmader unfortunately I can't be of much help, I definitely don't have the bandwidth to dig into this, and it's definitely not something I personally ever encounter since I don't use dart:developer
logs.
Based on the issue you linked, seems that are intended to only be shown when the app is run in debug mode, so possible only whilst using something like run_with_dap
. If they don't show up in the normal stdout
of the flutter run command, then I can't do anything about that. If they are part of the logs whilst being run via dap then you could have a look at the dap_runner.lua
file. There are specific events being listened too and appended to the log, and the dev logs might be an event within that.
I don't know which it is or really how the dap runner works since another user contributed it (🙏🏿 ).
@Thesmader did you figure this one out?
Hi @euler007 . I believe the dart developer logs are showing up atleast while developing on mobile. Haven't tried with web or other platforms.
Yeah without dap, the dev logs won't come up
Otherwise you can see them in devtools; in dev tools -> logging, you can apply a filter, iirc -k:flutter.frame
to reduce the noise and get (mostly) just your logging