many_lints 0.4.3
many_lints: ^0.4.3 copied to clipboard
A comprehensive collection of custom lint rules, quick fixes, and code assists for Flutter and Dart projects.
A useful collection of custom lints for Flutter & Dart projects. Uses the new analysis_server_plugin system for direct integration with dart analyze and IDEs.
Browse all rules on the documentation site
Getting started #
Requires Dart 3.10+ (Flutter 3.38+)
Add many_lints to the top-level plugins section in your analysis_options.yaml file (NOT under analyzer:):
plugins:
many_lints: ^0.4.3
That's it — the analysis server will automatically download and resolve the plugin from pub.dev. There is no need to add it to your pubspec.yaml.
Important: After any change to the
pluginssection, you must restart the Dart Analysis Server.
For local development setup, see CONTRIBUTING.md.
Configuring diagnostics #
All rules are registered as warnings and enabled by default. You can enable or disable individual rules under the diagnostics key:
plugins:
many_lints:
version: ^0.4.3
diagnostics:
prefer_center_over_align: true
use_bloc_suffix: false
Available Lints #
100 lints with 78 quick fixes, all enabled by default as warnings. Each rule links to its full documentation with examples and fix details.
| Category | Rules | Description |
|---|---|---|
| Async Safety | 2 | Async/await and state mutation safety |
| BLoC & Riverpod | 9 | BLoC and Riverpod state management patterns |
| Class Naming | 3 | Class and type naming conventions |
| Code Organization | 3 | Code structure and organization |
| Code Quality | 2 | General code quality improvements |
| Collections & Types | 13 | Collection and type-related checks |
| Control Flow | 11 | Control flow statements and patterns |
| Hook Rules | 2 | Flutter Hooks conventions |
| Pattern Matching | 4 | Dart pattern matching best practices |
| Resource Management | 3 | Resource cleanup and disposal |
| Riverpod State | 2 | Riverpod-specific state rules |
| Shorthand Patterns | 4 | Dot shorthand syntax patterns |
| State Management | 6 | StatefulWidget and state patterns |
| Testing | 4 | Testing best practices and matchers |
| Type Annotations | 5 | Type annotation conventions |
| Widget Best Practices | 14 | General widget best practices |
| Widget Replacement | 13 | Simpler widget alternatives |
Available Assists #
- Convert to collection-for: Converts
.map().toList()or.map().toSet()to collection-for syntax.
Suppressing Diagnostics #
To suppress a specific lint, use comments:
// ignore: many_lints/prefer_center_over_align
const Align(...);
// ignore_for_file: many_lints/use_bloc_suffix
Example #
See the example/ directory for a Flutter project that demonstrates every lint rule in action. Each file corresponds to a single rule and contains code that triggers the lint.
