Running and Debugging Dart Command-Line Applications
With RubyMine, you can run and debug Dart command line applications. RubyMine supports two debugging modes:
- Local debugging is initiated through a run/debug configuration of the type Dart Command Line App.
- Debugging of a remote application is initiated through a run/debug configuration of the type Dart Remote Debug.
Running a Dart command-line application
- Open the the Dart file to start the application from or select it in the Project view. This file must contain a
main()
method. - On the context menu of the selection, choose Run '<dart_file_name>'. RubyMine 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
- Configure and set breakpoints in the Dart code.
- Open the the Dart file to start the application from or select it in the Project view. This file must contain a
main()
method. - On the context menu of the selection, choose Debug '<dart_file_name>'. RubyMine generates a run/debug configuration of the type Dart Command Line App and starts a debugging session with it.
- 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
In this mode, the debugger connects to a remote DartVM. A debugging session is initiated via a Dart Remote Debug run/debug configuration.
To create a Dart Remote Debug run/debug configuration:
- On the main menu, choose , click and choose Dart Remote Debug from the list. The Run/Debug Configuration: Dart Remote Debug opens.
- In the Host field, specify the address of the computer where the Dart Virtual Machine is running, the default value is
localhost
. - 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. - From the Search Sources in drop-down list, If your RubyMine project contains several Dart projects configured as content roots, choose the Dart project to debug.
To launch a remote debugging session:
- 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. - Choose the newly created Dart Remote Debug configuration in the Select run/debug configuration drop-down list and click .
- 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: 21 July 2017