The debugger in IntelliJ or the Dart Editor won't stop at the breakpoint for this code:
main() async {
var x = 1;
bool stop = true; // breakpoint here
}
... but does for this code:
main() {
var x = 1;
bool stop = true; // breakpoint here
}
Dart SDK 1.8.3 and latest stable releases on both IDEs.
Open Dart DevTools to debug the app that’s running in the current window. If Dart Debug Extension is installed and you used the --debug-extension flag to webdev, click the Dart logo at the top right of the browser window. If you used the --debug flag to webdev, press Alt + D (or Option + D on macOS).
DevTools, a suite of performance and profiling tools that run in a browser. Android Studio/IntelliJ, and VS Code (enabled with the Flutter and Dart plugins) support a built-in source-level debugger with the ability to set breakpoints, step through code, and examine values.
To enable Dart DevTools, add the --debug or --debug-extension option (at the command line or through your IDE): When running your app using the --debug flag of webdev , you can open Dart DevTools by pressing Alt + D (or Option + D on macOS).
However, while it can improve your program’s overall throughput, async code is still not exempt from bugs! Writing async code makes debugging more difficult when potential deadlocks, vague error messages, and finding which task (s) are causing a bug are thrown into the mix.
This is a known issue that is fixed in the dev channel and will be released in the 1.9 stable channel. See Breakpoint set inside of async function does not trigger.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With