PyCharm 2017.2 Help

Running and Debugging Dart Command-Line Applications

This feature is supported in the Professional edition only.

With PyCharm, you can run and debug Dart command line applications. PyCharm supports two debugging modes:

  • Local debugging: in this mode, your application is started from PyCharm and is running locally on your computer. To run or debug it, use a Dart Command Line App configuration.
  • Debugging a remote application: in this mode, your application is running in a remote environment, for example, in a Docker container. To debug it, use a Dart Remote Debug configuration.

Running a Dart command-line application

  1. Open the the Dart file to start the application from or select it in the Project view. This file must contain a main() method.
  2. On the context menu of the selection, choose Run '<dart_file_name>'. PyCharm generates a run/debug configuration of the type Dart Command Line App and launches your application with it.

Debugging a Dart command-line application locally

  1. Configure and set breakpoints in the Dart code.
  2. Open the the Dart file to start the application from or select it in the Project view. This file must contain a main() method.
  3. On the context menu of the selection, choose Debug '<dart_file_name>'. PyCharm generates a run/debug configuration of the type Dart Command Line App and starts a debugging session with it.
  4. In the Debug Tool Window that opens, step through the program, stop and resume program execution, examine it when suspended, etc.

Debugging a remote Dart command-line application

If your application is running in a remote environment, for example, in a Docker container, you can debug it using a Dart Remote Debug configuration.

To create a Dart Remote Debug run/debug configuration

  1. On the main menu, choose Run | Edit Configurations, click add.png and choose Dart Remote Debug from the list. The Run/Debug Configuration: Dart Remote Debug opens.
  2. In the Host field, specify the address of the computer where the Dart Virtual Machine is running, the default value is localhost.
  3. Specify the port through which the debugger will connect to the remote application, the default value is 5858. The specified port is shown in the Use the command line arguments when starting the remote VM read-only field. Note that a remote application must be started exactly with these arguments.
  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.

To launch a remote debugging session

  1. Start a remote Dart application with the VM options from the Command line arguments for the remote Dart VM field in the Dart Remote Debug run configuration, for example, --enable-vm-service:5858 --pause_isolates_on_start.The application starts, immediately suspends thanks to the --pause_isolates_on_start argument, and waits for the debugger to connect.
  2. Choose the newly created Dart Remote Debug configuration in the Select run/debug configuration drop-down list and click /help/img/idea/2017.2/debug.png.
  3. 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: 9 August 2017