Running a Dart command-line application

Create a run configuration:

On the main menu, choose Run | Edit Configurations.

Click the Add New Configuration toolbar button ,
and choose Dart Command Line Application on the context menu.

In the Run/Debug Configuration: Dart Command Line Application dialog box that opens,
specify the Dart file to start the application from.
The file must contain a main() method.
Optionally specify the options to launch the Dart Virtual Machine with and the program options to start the application with.

Click OK to save the configuration settings.

Choose the newly created configuration in the Select run/debug configuration drop-down list on the tool bar
and click the Run toolbar button .

View the results in the Console tab of the Run tool window.

Debugging a Dart command-line application

With WebStorm, you can debug Dart command-line applications in two modes:

Local debugging. In this mode, you launch the application to debug and start a debugging session
through one same run configuration.

Remote debugging. In this mode, you initiate a debugging session and connect to an already running application.
This application can be launched on another host machine or you can previously start it on your machine
through another run configuration.

Click the Add New Configuration toolbar button ,
and choose Dart Command Line Application on the context menu.

In the Run/Debug Configuration: Dart Command Line Application dialog box that opens,
specify the Dart file to start the application from.
The file must contain a main() method.
Optionally specify the options to launch the Dart Virtual Machine with and the program options to start the application with.

Click OK to save the configuration settings.

Choose the newly created configuration in the Select run/debug configuration drop-down list on the tool bar
and click the Debug toolbar button .

Click the Add New Configuration toolbar button ,
and choose Dart Command Line Application on the context menu.

In the Run/Debug Configuration: Dart Remote Debug dialog box that opens,
specify the host where the Dart application is running and the port for the debugger to communicate with this host.
The specified port is shown in the Command line arguments for the remote Dart VM read-only field.
Note that the application must be started exactly with these arguments, so do not forget to provide this information to the one who will start it on the remote host
or specify the arguments in the Dart Remote Debug run configuration if you are going to launch the application yourself on the localhost.

From the Search Sources in drop-down list,
choose the Dart project to debug if your WebStorm project contains several Dart projects
configured as content roots.

Click OK to save the configuration settings.

Make sure the command-line application to debug is running with the arguments from the Command line arguments for the remote Dart VM read-only field
in the Dart Remote Debug run configuration.

Choose the newly created Dart Remote Debug configuration in the Select run/debug configuration drop-down list on the tool bar
and click the Debug toolbar button .