Skip to content

sznm_lints

pub packagelikespub points

agustinusnathaniel's personal lint rules for Dart and Flutter projects.

Features

  • 🎯 40+ Additional Rules - Extends flutter_lints with strict rules for better code quality
  • 📝 Type Safety - Enforces explicit type annotations and proper null safety
  • 🎨 Code Style - Consistent formatting and style rules
  • 🚀 Performance - Rules to catch common performance issues
  • 📦 Well Documented - Each rule includes references and explanations

Installation

Add sznm_lints as a dev dependency in your pubspec.yaml:

yaml
dev_dependencies:
  sznm_lints: ^2.0.0

Then create or update your analysis_options.yaml:

yaml
include: package:sznm_lints/flutter.yaml

Requirements

  • Dart: ^3.8.0
  • Flutter: >=3.41.0

What's Included

sznm_lints extends flutter_lints which itself extends package:lints/recommended.yaml.

Additional Rules (40+)

Some of the key rules added:

CategoryRules
Type Annotationsalways_specify_types, always_declare_return_types
Code Styleprefer_single_quotes, require_trailing_commas, sort_constructors_first
Null Safetyprefer_null_aware_method_calls, unnecessary_null_checks
Performanceavoid_slow_async_io, avoid_dynamic_calls
Best Practicesavoid_type_to_string, avoid_void_async, cancel_subscriptions

For the complete list, see All Rules.

Usage

Flutter Projects

yaml
# analysis_options.yaml
include: package:sznm_lints/flutter.yaml

Dart Projects (Non-Flutter)

Create a custom configuration:

yaml
# analysis_options.yaml
include: package:lints/recommended.yaml

linter:
  rules:
    # Add specific rules from sznm_lints as needed
    - prefer_single_quotes
    - require_trailing_commas

Migration Guide

From v1.x to v2.0.0

Version 2.0.0 requires:

  • Dart SDK ^3.8.0 (was >=2.15.1 ❤️.0.0)
  • Flutter >=3.41.0 (was >=1.17.0)
  • flutter_lints ^6.0.0 (was ^2.0.1)

Breaking Changes:

  • New rules: strict_top_level_inference, unnecessary_underscores
  • Removed redundant rules that are now in flutter_lints by default

License

MIT License - see LICENSE for details.

Released under the MIT License.