Dart
To analyze Dart and Flutter projects, you can use the Qodana Polyglot linter that has the following characteristics:
Characteristic | Description |
|---|---|
Linter name |
|
Docker image |
|
Based on | The Flutter SDK |
Available under licenses | Ultimate and Ultimate Plus licenses |
Shipped as | A native solution and a Docker image |
Supported language | Dart |
Supported framework | Flutter |
Supported Qodana features |
Before you start
Install project dependencies
Before starting the linter, make sure that project dependencies are set up. You can do this using the bootstrap key of your YAML configuration, for example:
The command will be automatically executed before the analysis. For plain Dart projects, use the dart pub get command instead.
Qodana Cloud
Because the Qodana Polyglot linter requires a Qodana Cloud project token for identifying and verifying a license, follow these steps to get it:
Navigate to Qodana Cloud and create an account there.
In Qodana Cloud, create an organization, a team, and a project.
On the project card, you can find the project token that you will be using further in this section.
Prepare your software
On the tab of the GitHub UI, create the QODANA_TOKEN encrypted secret and save the project token as its value.
If you are using Linux, you should be able to run Docker under your current non-root user.
Follow the instructions from the Qodana CLI page on GitHub.
Configure the SDK
To analyze plain Dart projects, provide the path to the Dart SDK using the QODANA_FLUTTER_PATH environment variable. In this case, the Flutter SDK is not required.
To analyze Flutter projects, the Qodana Polyglot linter uses the Flutter SDK available via the PATH. To use a specific installation, set the QODANA_FLUTTER_PATH environment variable to the bin directory of your Flutter SDK.
The Docker version of Qodana Polyglot requires manual configuration of the Flutter/Dart SDK.
Run Qodana
The Dart SDK dependency management uses absolute paths that are not cross-compatible between Docker and native deployment modes. Use native mode to avoid the potential issues with dependency setup in your local development while using Qodana CLI. In Docker mode, SDK is not shipped within the jetbrains/qodana-poly:2026.3 image, so you should provide it manually by using the bootstrap option.
You can run Qodana using the Qodana Scan GitHub action.
To analyze the main branch, release branches and the pull requests coming to your repository in native mode, save this workflow configuration to the .github/workflows/code_quality.yml file:
This configuration uses the --linter option to specify a linter. The --within-docker option in the false state is used for enabling native mode.
More configuration examples are available in the GitHub Actions section.
Run this command in the project root directory:
This configuration uses the --linter option to specify the Qodana Polyglot linter. The --within-docker option in the false state is used for enabling native mode.
If you are using another Qodana Cloud instance than https://qodana.cloud/, override it by declaring the QODANA_ENDPOINT environment variable.
In your browser, open Qodana Cloud to examine analysis reports and reconfigure the analysis. See the Analysis reports section of the documentation for full details.
Explore analysis reports
After Qodana analyzed your project and uploaded the analysis reports to Qodana Cloud, in Qodana Cloud navigate to your project and review analysis reports.
Extend Qodana configuration
Configuring inspections and scope
The Qodana Polyglot linter reads the analysis scope and rules from the analysis_options.yaml files contained in the repository, so any changes to the analysis scope, i.e., included and excluded files and directories or ruleset should be made in those files.
The only inspection that you can configure via a YAML file is the DartAnalyze inspection acting as a single toggle for all Dart and Flutter analysis. This inspection is enabled by default. To disable the inspection, for example, when you only need other inspections from the linter, exclude it as follows:
Enabling the baseline feature
Save the snippet to the .github/workflows/code_quality.yml file containing the --baseline option that specifies the path to a SARIF-formatted baseline file:
Run this command in the project root directory using the --baseline option to specify the path to a SARIF-formatted file containing a baseline:
In your browser, open Qodana Cloud to examine the analysis reports and reconfigure the analysis. See the Analysis reports section of the documentation for full details.
Enabling the quality gate
You can configure the quality gate for a total number of problems:
Save the snippet to the .github/workflows/code_quality.yml file containing the --fail-threshold option that specifies the number of problems:
Run this command in the project root directory using the --fail-threshold option to specify the number of problems accepted as a quality gate:
Analyzing pull requests
The Qodana Scan GitHub action automatically analyzes all pull requests, so you do not have to provide any additional configuration. Save this configuration to the .github/workflows/code_quality.yml file:
To analyze changes in your code, employ the --diff-start option and specify a hash of the commit that will act as a base for comparison: