> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-server/10.8/analyzing-source-code/languages/dart.md).

# Dart

SonarQube Server 10.8 can analyze the Dart language.

{% hint style="info" %}
**For AI agents:** You're in the SonarQube Server 10.8 documentation. For a list of all 10.8 pages, see the [SonarQube Server 10.8 page index](https://312504542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiJj3TXBdWssTGGg8qK5I%2Fuploads%2FmeJ1nVNGPezOurNrTy4A%2Fsonarqube-server-10.8-llms.txt?alt=media). For the whole site, see the [page index](https://docs.sonarsource.com/llms.txt) or the [full text](https://docs.sonarsource.com/llms-full.txt). For another version, replace 10.8 in the URL with that version. The [latest version](https://docs.sonarsource.com/sonarqube-server/) has no version number in its URL.
{% endhint %}

## Language-specific properties <a href="#language-specific-properties" id="language-specific-properties"></a>

You can discover and update Dart-specific [Analysis parameters](/sonarqube-server/10.8/analyzing-source-code/analysis-parameters.md) in the project **Administration** > **Configuration** > **General Settings** > **Languages** > **Dart**

## Preparing the analysis <a href="#preparing-the-analysis" id="preparing-the-analysis"></a>

Before performing the analysis, we highly recommend:

* retrieving all project dependencies declared in `pubspec.yaml`, for example, by\`\`running `flutter pub get` for Flutter projects, `dart pub get` for Dart projects, etc.
* performing a full and successful build of your Flutter or Dart project

Otherwise, you might get incomplete and potentially incorrect analysis results. Running `flutter pub get` or `dart pub get` alone may not be enough to produce a correct analysis, for example, when you analyze generated code.

## Analyzing generated code <a href="#analyzing-generated-code" id="analyzing-generated-code"></a>

When code generation is done via [automated source code generation](https://github.com/dart-lang/source_gen), the analysis of generated code can only happen after the execution of `source_gen`, which requires a full build of the Flutter or Dart project containing the builders.

When code generation is done via lower-level packages such as [build](https://pub.dev/packages/build), the analysis should only happen once the source has been generated and persisted on disk.

{% hint style="warning" %}
Sonar provides the [`sonarqube-scan-action` action](https://github.com/marketplace/actions/official-sonarqube-scan) to ease the configuration of the analysis in GitHub.

However, up to `v3`, the GitHub Action runs the analysis in a Docker container, which has only access to the directory where the project is checked out.

That means that the action doesn’t have access to the directory where dependencies have been retrieved, after running `flutter pub get`, `dart pub get`, or a similar command, which may result in an incomplete and potentially incorrect analysis.

Therefore, we suggest either using `v4` or above, which is based on a [composite action](https://docs.github.com/en/actions/sharing-automations/creating-actions/creating-a-composite-action) instead, or [SonarScanner CLI](/sonarqube-server/10.8/analyzing-source-code/scanners/sonarscanner.md) directly (see the "Running SonarScanner CLI from the zip file" section).
{% endhint %}

## Related pages <a href="#related-pages" id="related-pages"></a>

* [Dart test coverage](/sonarqube-server/10.8/analyzing-source-code/test-coverage/dart-test-coverage.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sonarsource.com/sonarqube-server/10.8/analyzing-source-code/languages/dart.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
