PyCharm 2016.3 Help

Running and Debugging Dart Command-Line Applications

This feature is supported in Professional edition only.

For running and debugging Dart command-line applications, PyCharm provides a dedicated run/debug configuration of the type Dart Command Line Application.

On this page:

Running a Dart command-line application

  1. Create a run configuration:
    1. On the main menu, choose Run | Edit Configurations.
    2. Click the Add New Configuration toolbar button add.png, and choose Dart Command Line Application on the context menu.
    3. 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.
    4. Click OK to save the configuration settings.
  2. Choose the newly created configuration in the Select run/debug configuration drop-down list on the tool bar and click the Run toolbar button /help/img/idea/2016.3/run.png.
  3. View the results in the Console tab of the Run tool window.

Debugging a Dart command-line application

With PyCharm, 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.

To debug a Dart command-line application locally:

  1. Configure and set breakpoints in the Dart code.
  2. Create a run configuration:
    1. On the main menu, choose Run | Edit Configurations.
    2. Click the Add New Configuration toolbar button add.png, and choose Dart Command Line Application on the context menu.
    3. 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.
    4. Click OK to save the configuration settings.
  3. Choose the newly created configuration in the Select run/debug configuration drop-down list on the tool bar and click the Debug toolbar button /help/img/idea/2016.3/debug.png.
  4. In the Debug Tool Window that opens, step through the program, stop and resume program execution, examine it when suspended, etc.

To debug a Dart command-line application remotely:

  1. Create a Dart Remote Debug run configuration:
    1. On the main menu, choose Run | Edit Configurations.
    2. Click the Add New Configuration toolbar button add.png, and choose Dart Command Line Application on the context menu.
    3. 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.
    4. From the Search Sources in drop-down list, choose the Dart project to debug if your PyCharm project contains several Dart projects configured as content roots.
    5. Click OK to save the configuration settings.
  2. 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.
  3. 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 /help/img/idea/2016.3/debug.png.
  4. In the Debug Tool Window that opens, step through the program, stop and resume program execution, examine it when suspended, etc.

See Also

Last modified: 23 December 2016