Using Integration with the Dart Analysis Server
On this page:
- Messages list
- Grouping and sorting
- Navigation and speed search
- Configuring the scope of files to view problem reports from
PhpStorm provides interface for using the Dart Analyzer tool. The tool is intended for static analysis of your Dart source code. All inconsistencies and potential problems are reported in the dedicated Dart Analysis tool window with the possibility to navigate to the fragment of the source code where the problem was detected.
- The Description column shows the message itself, which can be an error message, a warning, or a hint.
- The Location column shows the following data:
- The Summary area below the table shows the number of detected errors, warnings, or hints and the filter status.
Grouping and sorting
The messages in the Dart Analysis tool window can be grouped and sorted. By default, the messages are primarily sorted by their severity, that is, the error messages are shown at the top of the list, then come warnings, and finally hints are displayed. In each severity group, messages are grouped by the Dart package name, which is super handy for projects with multiple
pubspec.yaml files. In each package group, the messages are grouped by their file paths. Finally, in each file group, the problems are sorted by the line number where they occurred.
You can re-configure the secondary sorting:
- Click the Location column header to switch between the ascending and descending order of the Dart package name + file path sorting. Note that this does not affect the order of severity groups, that is, errors are always shown first. Line numbers are not taken into consideration either, for each particular file problems are always shown in ascending order of line numbers.
- Click the Description column header to perform the secondary sorting alphabetically by the problem description. Note that this does no affect the primary grouping by severity.
To disable the primary grouping by severity, release the Group by Severity toggle button on the toolbar. After that the severity of a problem is not taken into consideration at all and problem reports are sorted only by their Description or Location (Dart package name + file path). This sorting method guarantees that all the problems for each particular file are grouped together in the table, regardless of their severity.
Navigation and speed search
PhpStorm provides speed search through the messages in the Dart Analysis tol window with the possibility to navigate from a problem report to the fragment of the source code where the problem was detected.
- To locate problems for a specific file or to find a particular message, move the focus to the table and start typing the file name or the text of the message. PhpStorm detects the matching row and selects it.
Fuzzy search with partial and middle matching is also supported. For example, if you start typing
ain, the messages related to the
main.dartfill be also detected.
- To navigate from a problem report to the source code where the problem occurred, select the message in question and choose Jump to Source on the context menu of the selection.
- To have PhpStorm automatically open the source file with the problem reported in the selected row, press the Autoscroll to Source toggle button on the toolbar.
Configuring the scope of files to view problem reports from
You can configure the criteria according to which a problem report is displayed in the tool window or not:
- Click the Filter button on the toolbar.
- In the Dart Problems Filter pop-up window, specify the following:
- In the Severity area, specify the types of messages to be shown, the available types are Errors, Warnings, and Hints. To have the problems of a severity level displayed, select the check box next to this severity level.
- In the Files area, choose the scope for which you want to see problem reports. The available options are:
- Click the Reset all filters link to restore the default filter settings.
Filtering is applied immediately as soon as you change the current settings.