flutter_sane_lints 0.1.1
flutter_sane_lints: ^0.1.1 copied to clipboard
A custom lint for flutter projects to avoid ad-hoc string literals.
Flutter Sane Lints #
A custom lint plugin to try and improve maintainability in Flutter projects by disallowing certain anti-patterns. At the moment, the only dart lint rule in this plugin is to avoid declaring ad-hoc strings inside Widget/State classes, or passing a literal to a Widget constructor.
Every String used for presentation (such as in a Text widget) should be defined in a l10n file. See Flutter Internationalization Tutorial.
Every String used for logic (such as in a switch statement) should be defined as an Enum or in any other way that makes sense for the use case while following good OO design. Using strings is a clear sign of primitive obsession and should be avoided.
Created with the Very Good CLI 💙
Installation 💻 #
❗ In order to start using Flutter Sane Lints you must have the Flutter SDK installed on your machine.
Add flutter_sane_lints
and custom_lint
to your pubspec.yaml
:
dev_dependencies:
custom_lint:
flutter_sane_lints:
Install it:
flutter pub get
Usage 🚀 #
Add the custom_lint package to your analysis_options.yaml
:
analyzer:
plugins:
- custom_lint