+ [Style](https://dart.dev/effective-dart/style)
+ [Documentation](https://dart.dev/effective-dart/documentation)
+ [Usage](https://dart.dev/effective-dart/usage)
+ [Design](https://dart.dev/effective-dart/design)
* Development expand_more
+ [JSON serialization](https://dart.dev/libraries/serialization/json)
+ [Number representation](https://dart.dev/resources/language/number-representation)
+ [Google APIs](https://dart.dev/resources/google-apis)

...

* [build_runner](https://dart.dev/tools/build_runner)
* [package:skills](https://dart.dev/tools/package-skills)
* [webdev](https://dart.dev/tools/webdev)
+ Static analysis expand_more
- [Customizing static analysis](https://dart.dev/tools/analysis)
- [Fixing type promotion failures](https://dart.dev/tools/non-promotion-reasons)
- [Linter rules](https://dart.dev/tools/linter-rules)
- [Analyzer plugins](https://dart.dev/tools/analyzer-plugins)

...

list On this page chevron_right Analyzer plugins
vertical_align_top Analyzer plugins
* Use analyzer plugins
  + Enable a plugin
  + Configure diagnostics
  + Suppress diagnostics
* Write an analyzer plugin
  + Set up the plugin package
  + Implement plugin features
  + Debug a plugin
Dart 3.13 is here!
Clean and lightweight code across every layer of Dart. Read the [announcement](https://dart.dev/blog/announcing-dart-3-13) .
list On this page

...

# Analyzer plugins
Analyzer plugins allow you to create custom lints, warnings, and IDE quick fixes for your Dart projects
more_vert
* content_copy Copy link
* [docs View source](https://github.com/dart-lang/site-www/blob/main/src/content/tools/analyzer-plugins.md)
* [bug_report Report issue](https://github.com/dart-lang/site-www/issues/new?template=1_page_issue.yml&page-url=https://dart.dev/tools/analyzer-plugins&page-source=https://github.com/dart-lang/site-www/blob/main/src/content/tools/analyzer-plugins.md)
merge_type Version note
Support for analyzer plugins was added in Dart 3.10.
Analyzer plugins extend the [Dart analyzer](https://dart.dev/tools/analysis) to report custom
diagnostics (lints and warnings), offer quick fixes,
and provide assists. This functionality is available directly
in your IDE and at the command line when you run `dart analyze` or `flutter analyze` .

## Use analyzer plugins
#
You can start using an analyzer plugin in your Dart project
by enabling it in the `analysis_options.yaml` file at the root of your package or workspace.
You can search for analyzer plugins on [pub.dev](https://pub.dev/packages?q=dependency%3Aanalysis_server_plugin) .

...

### Configure diagnostics
* Warnings that a plugin defines are enabled by
  default (just like standard analyzer warnings).
* Lint rules that a plugin defines are disabled by default
  and must be explicitly enabled in your analysis options file.
You can enable or disable specific lint rules under
the diagnostics section for a plugin:
analysis_options.yaml
yaml
```
plugins : my_plugin : path : /path/to/my_plugin diagnostics : rule_1 : true rule_2 : true rule_3 : false
```
content_copy
In the preceding example, `rule_1` and `rule_2` are enabled. `rule_3` is explicitly disabled, which is useful for
overriding a rule that might be enabled from an [`include:`](https://dart.dev/tools/analysis) file.

...

### Suppress diagnostics
For example, to suppress a diagnostic with the
code `some_code` from a plugin named `some_plugin` ,
use one of the following formats:
To suppress for a single line:
dart
```
// ignore: some_plugin/some_code
```
content_copy
To suppress for an entire file:
dart
```
// ignore_for_file: some_plugin/some_code
```
content_copy

...

## Write an analyzer plugin
Create your own analyzer plugin to add custom static analysis,
quick fixes, or [assists](https://dart.dev/resources/glossary) Assist An automated, local code edit targeted at making common improvements to code. [Learn more](https://dart.dev/resources/glossary "Learn more about 'Assist' and find related resources.") to the Dart development experience.

### Set up the plugin package
#
An analyzer plugin is a standard Dart package with
specific dependencies and structure. The primary dependency
is the [`analysis_server_plugin` package](https://pub.dev/packages/analysis_server_plugin) ,
which provides the core `Plugin` class.
1. Create the `pubspec.yaml` file. For example:
yaml
  ```
  name : test_analyzer_plugin version : 0.0 .1 ​ environment : sdk : ^3.10.0 ​ dependencies : analysis_server_plugin : ^0.3.0 analyzer_plugin : ^0.13.0 analyzer : ^8.0.0
  ```
content_copy
2. Create the plugin entry point. For example:
lib/main.dart
dart
  ```
  import ' package:analysis_server_plugin/plugin.dart ' ; import ' package:analysis_server_plugin/registry.dart ' ; ​ final plugin = SimplePlugin ( ) ; ​ class SimplePlugin extends Plugin { @override String get name => ' Simple plugin ' ; ​ @override void register ( PluginRegistry registry ) { // Register diagnostics, quick fixes, and assists. } }
  ```
content_copy
The preceding code represents the basic structure for plugin
entry point. Make sure that you have a `lib/main.dart` file
in your package because this is the entry point for the
analysis server to load your plugin.

...

* You need a top-level variable named `plugin` that
  instantiates your class. The Dart Analysis Server looks
  for this variable.
* Your class must extend `Plugin` from `package:analysis_server_plugin/plugin.dart` .
* Override the `register` method to add your
  plugin's features. This method serves as the main entry
  point for registering your custom analysis rules,
  quick fixes, and assists with the analyzer.

...

### Implement plugin features
#
Once you have your basic plugin package set up,
you can start adding custom functionality by
implementing the `register` method.
Read the following guides to learn how to implement specific
functionality:
* [Writing rules](https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server_plugin/doc/writing_rules.md)
* [Writing fixes](https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server_plugin/doc/writing_fixes.md)
* [Writing assists](https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server_plugin/doc/writing_assists.md)
* [Testing rules](https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server_plugin/doc/testing_rules.md)
Check the Dart Analysis Server for many examples of rules,
fixes, and, assists:
* [Dart Analysis Server's rules](https://github.com/dart-lang/sdk/tree/main/pkg/linter/lib/src/rules)
* [Dart Analysis Server's fixes](https://github.com/dart-lang/sdk/tree/main/pkg/analysis_server/lib/src/services/correction/dart)
* [Dart Analysis Server's assists](https://github.com/dart-lang/sdk/tree/main/pkg/analysis_server/lib/src/services/correction/dart)

...

### Debug a plugin
* Your first stop should be the [analyzer diagnostics pages](https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server/doc/tutorial/instrumentation.md) .
If your plugin's isolate crashes, the "plugins" screen
displays the crash information and stack trace.
* `print` statements won't work.
Plugins run in a separate isolate, and their standard output
is not connected to your console.
* The most reliable way to trace your plugin's execution

...

Was this page's content helpful?
thumb_up thumb_down
Unless stated otherwise, the documentation on this site reflects Dart 3.13.3. Page last updated on 2026-06-24.
[View source](https://github.com/dart-lang/site-www/blob/main/src/content/tools/analyzer-plugins.md) or [report an issue](https://github.com/dart-lang/site-www/issues/new?template=1_page_issue.yml&page-url=https://dart.dev/tools/analyzer-plugins&page-source=https://github.com/dart-lang/site-www/blob/main/src/content/tools/analyzer-plugins.md "Report an issue with this page") .