nilts_flutter_hooks 1.0.1
nilts_flutter_hooks: ^1.0.1 copied to clipboard
nilts_flutter_hooks provides lint rules, quick fixes, and assists for Dart and Flutter projects to help you enforce best practices and avoid errors.
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.
This is because rules defined in warnings cannot currently be disabled individually. By using diagnostics, you can enable only the rules you need.
To enable rules, use the map format with version: and diagnostics::
plugins:
nilts_flutter_hooks:
version: ^1.0.0
diagnostics:
unnecessary_hook_widget: true
For a complete example of enabling all rules, see analysis_options.yaml.
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.