IntelliJ IDEA 2024.2 Help

Dart Analysis tool window

The tool window is available only when the Dart plugin is installed and enabled. The Dart plugin is not bundled with IntelliJ IDEA, but it can be installed on the Settings | Plugins page, tab Marketplace, as described in Installing plugins from JetBrains Marketplace.

IntelliJ IDEA integrates with the Dart Analyzer tool that performs static analysis of your Dart source code. All inconsistencies and potential problems are reported in the Dart Analysis tool window with the possibility to navigate to the fragment of the source code where the problem was detected.

Message List

All the problem reports are displayed in a table which consists of two columns, Description and Location, and a summary below.

Dart Analysis tool window: Messages pane
  • 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 name of the Dart package in which the problem arose. The Dart package name corresponds to the project name from pubspec.yaml.

    • The relative path from the Dart package root to the file where the problem arose.

    • The line number where the problem arose.

  • The header of the tool window shows the number of detected errors, warnings, or hints as well as 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 icon_run_tool_window_dart_group_by_severity.png 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.

Fix detected problems

You can fix problems right from the Dart Analysis tool window.

  • Right-click a message and select a hotfix from the context menu.

    Select a hotfix or suppress an inspection
  • Alternatively, select Ignore '<inspection name>' for this line or Ignore '<inspection name>' for this file to suppress the inspection that detected the problem for a specific line or for the entire file.

    Select to ignore inspection

    An ignore: or an ignore_for_file comment is added above the line where the problem was detected and the error message disappears from list.

    An ignore comment added

    To re-enable a suppressed inspection, remove the added comment.

Toolbar Buttons

Item

Tooltip and shortcut

Description

Reanalyze Dart Sources

Restart Dart Analysis Server

Click this button to restart the Dart Analysis server and re-run the analysis of the Dart source code of the project.

Analyzer Settings

Analyzer Settings

Click this button to open the Dart Analysis Server Settings popup with the following options:

  • Scope analysis to the current package

  • Open Dart plugin settings - select this option to open the Dart page of the Settings dialog.

  • View analyzer diagnostics - select this option to open a page with general status and diagnostics for the analysis server.

Navigate with Single Click

Navigate with Single Click

If this button is pressed, the file that contains the selected error automatically opens in the editor, with the caret at the appropriate line.

Group by Severity

Group by Severity

  • When this toggle button is pressed, 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.

  • Release this toggle button to disable the primary grouping by severity. 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.

Filter

Filter

Click this button to open the Dart Problems Filter popup where you can configure the criteria according to which a problem report is displayed in the tool window or not.

  • 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 checkbox next to this severity level.

  • In the Files area, choose the scope for which you want to see problem reports. The available options are:

    • Whole project

    • Current content root

    • Current package: when this option is selected but no pubspec.yaml file is detected up the folder hierarchy starting from the current file, then filtering is performed according to the content root where current file is located.

    • Current file

  • Click the Reset all filters link to restore the default filter settings.

Filtering is applied immediately as soon as you change the current settings.

Context Menu

Item

Shortcut

Description

Jump to source

F4

Click this button to navigate to the fragment of code that caused the selected problem.

Copy

Ctrl+C

Take the line at caret to the clipboard.

Last modified: 04 September 2024