When running my Flutter application, I encounter a performance issue where the app and the debug console become completely unresponsive when logging large HTTP requests or responses.
Steps to Reproduce
Run the Flutter application in debug mode.
Trigger an HTTP request or response with a large payload.
Log the request or response data, especially when the payload size reaches approximately 30 KB or larger.
Expected Behavior
The application should remain responsive when handling large requests and responses.
Logging should not block the main isolate or overwhelm the debug console.
Large payloads should be logged efficiently, with appropriate truncation, chunking, or other optimizations if necessary.
Hey, thanks for the detailed report. Debug Console can get very slow when one log entry is very large. It also keeps all messages in memory for the whole debug session, so a few large payloads can add up fast.
For now, this should help:
Clear Debug Console from time to time the Clear Console icon in the console toolbar.
Log a shortened version of large bodies for example the first 2000 characters, or turn off request/response body logging in your HTTP logger.
Try setting "debug.console.wordWrap": false in settings so very long lines don’t get reflowed.
To narrow this down a bit more, could you check this:
Restart Cursor and open the Flutter project.
Add a temporary call that you can trigger for example from a button: print(jsonEncode(List.generate(500, (i) => {'id': i, 'name': 'item $i', 'url': 'https://example.com/items/$i'}))); This is about 30 KB in a single line.
Start debugging via Run > Start Debugging F5.
Trigger that log 3 to 5 times.
Check whether Debug Console and the app stop responding.
While it’s frozen, open Command Palette Cmd+Shift+P, run Developer: Open Process Explorer, and take a screenshot of the process using the most CPU.
Also, please let us know:
Does the same thing happen in VS Code with the same Dart and Flutter extension versions?
What logging method are you using print, debugPrint, log from dart:developer, or a package like dioLogInterceptor / pretty_dio_logger?
Does it get worse the longer the debug session runs?
What’s the Dart extension version from the Extensions tab?