Dart Debugging

In this tutorial you will learn about the Dart Debugging and its application with practical example.

Dart Debugging

Debugging is the process of detecting and removing of existing and potential errors in a Dart Program that can cause program to behave unexpectedly or crash. Debugging is used to find and fix bugs or defects so that program works as per the set specifications.

The WebStorm comes with rich debugging features. The debugger is one of the most essential features of WebStorm. With WebStorm you can develop, run, and debug Dart web and command-line applications. The WebStorm editor you are allowed to enable breakpoints for step-by-step debugging.

What Is Breakpoints?

Breakpoints are source code markers that let you break program execution at a specific point and examine its behavior. It prevent polluting our app with multiple print statements at checkpoints.

Adding a Breakpoint In WebStorm

In WebStorm, simply click on a line number in the left bar to attach a breakpoint. Once you have attached the breakpoints, simply run the program in debug mode. When program runs in debug mode, you will get the Debugger window where you can additionally configure how the breakpoint works. Additionally you can shows the values of variables in the current context. You can add watchers for specific variables and listen to that values changes using watches window.

Stepping Through Code

In WebStorm, the stepping actions are available on the top of the debug tool window, and they are activated when the breakpoint is hit.

Step Into (F7) :- This will execute code line by line in this or another file. But, if the current statement includes a function call, then execution will jump to its definition and stop at the first line.
Step over (F8) :- This will execute the code line by line in the current file.
Step Out (Shift-F8) :- This will finish the execution of the current function and then stop at the next statement after the call.

 

In this tutorial we have learn about the Dart Debugging and its application with practical example. I hope you will like this tutorial.