many_lints 0.8.0 copy "many_lints: ^0.8.0" to clipboard
many_lints: ^0.8.0 copied to clipboard

A comprehensive collection of custom lint rules, quick fixes, and code assists for Flutter and Dart projects.

Pub Package Build Status coverage 95% MIT License analyzer version 14.1.0 Documentation

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.11+ (Flutter 3.41+)

Add many_lints to the top-level plugins section in your analysis_options.yaml file (NOT under analyzer:):

plugins:
  many_lints: ^0.8.0

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 plugins section, 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.8.0
    diagnostics:
      prefer_center_over_align: true
      use_bloc_suffix: false

Available Lints #

133 lints with 92 quick fixes, all enabled by default as warnings. Each rule links to its full documentation with examples and fix details.

Category Rules Description
Class Naming 3 Class and type naming conventions
Bloc / Riverpod 10 BLoC and Riverpod state management patterns
Riverpod State 9 Riverpod-specific state rules
Async Safety 4 Async/await and state mutation safety
Widget Best Practices 18 General widget best practices
Widget Replacement 13 Simpler widget alternatives
State Management 8 StatefulWidget and state patterns
Control Flow 15 Control flow statements and patterns
Collection & Type 18 Collection and type-related checks
Pattern Matching 6 Dart pattern matching best practices
Type Annotations 5 Type annotation conventions
Code Organization 3 Code structure and organization
Shorthand Patterns 4 Dot shorthand syntax patterns
Hook Rules 4 Flutter Hooks conventions
Testing Rules 3 Testing best practices and matchers
Resource Management 3 Resource cleanup and disposal
Code Quality 7 General code quality improvements

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

The many_lints/ prefix is required. Unlike SDK lints, a plugin diagnostic is only silenced when the rule name is prefixed with the plugin name, so a bare // ignore: prefer_center_over_align has no effect. The prefix is the key used under plugins: in analysis_options.yaml.

Suppressing by type is also possible via // ignore: type=lint (the type= form is required, and it silences every lint on that line, SDK ones included).

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.

5
likes
0
points
1.18k
downloads

Documentation

Documentation

Publisher

verified publisherdominikkrajcer.com

Weekly Downloads

A comprehensive collection of custom lint rules, quick fixes, and code assists for Flutter and Dart projects.

Homepage
Repository (GitHub)
View/report issues

Topics

#lint #lints #linter #analyzer #code

License

unknown (license)

Dependencies

analysis_server_plugin, analyzer, analyzer_plugin

More

Packages that depend on many_lints