nilts_flutter_hooks
nilts_flutter_hooks provides lint rules, quick fixes, and assists for Dart and Flutter projects to help you enforce best practices and avoid errors.
Contents
Usage
Note: nilts_flutter_hooks no longer supports custom_lint.
If you're using custom_lint, please use nilts_flutter_hooks versions below v1.0 and refer to README_CUSTOM_LINT.md.
If you're using Dart SDK version 3.10 or later, add nilts_flutter_hooks to the top-level plugins section of your analysis_options.yaml file:
plugins:
nilts_flutter_hooks: ^1.0.0
Configuration
All lint rules in nilts_flutter_hooks are disabled by default.
Enable all rules (recommended)
To enable all rules, use the include directive with the provided configuration file.
Always use the latest
include: package:nilts_flutter_hooks/analysis_options_all.yaml
Pin to a specific version
include: package:nilts_flutter_hooks/analysis_options_all.1.0.0.yaml
Pinning to a versioned file ensures consistent lint rule enforcement across team members and CI/CD pipelines.
Enable specific rules
To enable specific rules, use the map format with version: and diagnostics::
plugins:
nilts_flutter_hooks:
version: ^1.0.0
diagnostics:
unnecessary_hook_widget: true
See also:
Lint rules and quick fixes
See below to learn what each lint rule does. Some rules support quick fixes in your IDE.
Overview
| Rule name | Overview | Target SDK | Rule type | Maturity level | Severity | Quick fix |
|---|---|---|---|---|---|---|
| unnecessary_hook_widget | Checks if the widget is unnecessary to use HookWidget. |
Any versions nilts_flutter_hooks supports | Practice | Stable | Info | ✅️ |
Details
unnecessary_hook_widget
- Target SDK : Any versions nilts_flutter_hooks supports
- Rule type : Practice
- Maturity level : Stable
- Severity : Info
- Quick fix : ✅
Prefer using StatelessWidget instead of HookWidget when no hooks are used within the widget.
BAD:
class MyWidget extends HookWidget {
@override
Widget build(BuildContext context) {
return Container();
}
}
GOOD:
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container();
}
}
See also:
Assists
Coming soon... 🚀
Feature requests
If you have any feature requests, please create an issue from this template.
Bug reports
If you find any bugs, please create an issue from this template.
Contributing
Contributions are welcome! Please read the CONTRIBUTING guide before submitting your PR.
Libraries
- main
- nilts_flutter_hooks
- This file exists to satisfy the pub naming convention.