hardcoded_strings_lint 1.0.4 copy "hardcoded_strings_lint: ^1.0.4" to clipboard
hardcoded_strings_lint: ^1.0.4 copied to clipboard

A custom Flutter lint rule that identifies and prevents hardcoded strings in widget constructors, promoting better internationalization practices and code maintainability.

Changelog #

All notable changes to the hardcoded_strings_lint package will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

1.0.4 - 2025-10-09 #

Improved #

  • Refined widget argument detection logic to prevent false positives
  • Strings inside callback or function bodies are no longer incorrectly flagged as hardcoded strings
  • Enhanced accuracy in detecting hardcoded strings passed to widget constructors

1.0.3 - 2025-09-18 #

Improved #

  • Extract to variable fix now generates camelCase variable names instead of snake_case

Updated #

  • Documentation

1.0.2 - 2025-09-18 #

Updated #

  • Updated dependencies

1.0.1 - 2025-06-05 #

Documentation #

Updated documentation

1.0.0 - 2025-06-05 #

Added #

  • Initial release of hardcoded_strings_lint package
  • Custom lint rule avoid_hardcoded_strings_in_widgets to detect hardcoded strings in Flutter widgets
  • Smart filtering system that ignores technical strings, map keys, and acceptable widget properties
  • Built-in quick fixes:
    • Add ignore comment functionality
    • Extract to variable functionality (both method and class scope)
  • Comprehensive ignore comment support with multiple patterns
  • Intelligent detection of Flutter widget contexts
  • Technical string pattern recognition (URLs, emails, hex colors, file paths, identifiers)
  • Support for acceptable widget properties (semantics, debug labels, asset references, etc.)
  • Automatic filtering of short strings (≤2 characters) and empty strings

Features #

  • Smart Detection: Identifies hardcoded strings specifically in Flutter widget constructors
  • Intelligent Filtering: Distinguishes between user-facing text and technical configuration
  • Quick Fixes: Automated solutions for common hardcoded string issues
  • Flexible Ignores: Multiple ignore comment patterns for different use cases
  • Performance Optimized: Only analyzes strings in widget contexts

Technical Details #

  • Built on custom_lint_builder ^0.7.5
  • Compatible with analyzer ^7.4.5
  • Integrates seamlessly with Flutter's analysis system
  • Supports both line-specific and file-level ignores
7
likes
160
points
707
downloads

Publisher

unverified uploader

Weekly Downloads

A custom Flutter lint rule that identifies and prevents hardcoded strings in widget constructors, promoting better internationalization practices and code maintainability.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

analyzer, analyzer_plugin, custom_lint_builder

More

Packages that depend on hardcoded_strings_lint