nilts_flutter_hooks 0.1.0 copy "nilts_flutter_hooks: ^0.1.0" to clipboard
nilts_flutter_hooks: ^0.1.0 copied to clipboard

nilts_flutter_hooks is lint rules, quick fixes and assists for Dart and Flutter projects using flutter_hooks that helps you enforce best practices, and avoid errors.

nilts_flutter_hooks #

nilts_flutter_hooks is lint rules, quick fixes and assists for Dart and Flutter projects that helps you enforce best practices, and avoid errors.

build pub license


Contents #

Usage #

nilts_flutter_hooks depends on custom_lint. You should add nilts_flutter_hooks and custom_lint to your dev_dependencies in pubspec.yaml file.

dev_dependencies:
  custom_lint: <version>
  nilts_flutter_hooks: <version>
copied to clipboard

And also, add custom_lint to your analysis_options.yaml file.

analyzer:
  plugins:
    - custom_lint
copied to clipboard

Configuration #

You can configure all lint rules provided by nilts_flutter_hooks in analysis_options.yaml file. Choice one of the following configuration strategies.

Disabling strategy #

All of nilts_flutter_hooks rules are enabled by default. Add lint rule name and set false to disable it.

custom_lint:
  rules:
    # Disable particular lint rules if you want ignore them whole package.
    - unnecessary_hook_widget: false
copied to clipboard

Enabling strategy #

You can disable all lint rules depends on custom_lint by setting enable_all_lint_rules to false. Add lint rule name and set true to enable it.

custom_lint:
  # Disable all lint rules depends on custom_lint.
  enable_all_lint_rules: false
  rules:
    - unnecessary_hook_widget: true
copied to clipboard

NOTE: If you enable_all_lint_rules set to false, all of lint rules (not only all of nilts_flutter_hooks's lint rules) depends on custom_lint will be disabled by default.

Lint rules and quick fixes #

Read below to learn about each lint rules intend to. Some of lint rules support quick fixes on IDE.

Quick fix demo

Overview #

Rule name Overview Target SDK Rule type Maturity level Quick fix
unnecessary_hook_widget Checks if the widget is unnecessary to use HookWidget. Any versions nilts_flutter_hooks supports Practice Experimental ✅️

Details #

unnecessary_hook_widget

  • Target SDK : Any versions nilts_flutter_hooks supports
  • Rule type : Practice
  • Maturity level : Experimental
  • 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();
  }
}
copied to clipboard

GOOD:

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container();
  }
}
copied to clipboard

See also:

Assists #

Upcoming... 🚀

Known issues #

Quick fix priorities (Fixed) #

Important

Finding which a plugin version fixed the issue is hard, but it looks work as expected. Checked works as expected on Dart plugin 242.24931 and 243.23654.44.

The priorities assigned to quick fixes are not currently visible in IntelliJ IDEA and Android Studio due to the lack of support for PrioritizedSourceChange in these environments. In contrast, VS Code does support this feature, allowing quick fixes to be listed along with their respective priorities.

VS Code IntelliJ IDEA / Android Studio
VS Code IntelliJ IDEA / Android Studio

See also:

fix-all assist (Fixed) #

Important

Finding which a plugin version fixed the issue is hard, but it looks as expected. Checked works as expected on Dart plugin 242.24931 and 243.23654.44.

The fix-all assist feature has been introduced in custom_lint_builder 0.6.0. However, this feature is not yet supported in IntelliJ IDEA and Android Studio, owing to their current lack of support for PrioritizedSourceChange.

VS Code IntelliJ IDEA / Android Studio
VS Code IntelliJ IDEA / Android Studio

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 #

Welcome your contributions!! Please read CONTRIBUTING docs before submitting your PR.

1
likes
160
points
41
downloads

Publisher

verified publisherronnnnn.com

Weekly Downloads

2024.09.14 - 2025.03.29

nilts_flutter_hooks is lint rules, quick fixes and assists for Dart and Flutter projects using flutter_hooks that helps you enforce best practices, and avoid errors.

Repository (GitHub)
View/report issues
Contributing

Topics

#lints #lint #analysis #code-style #tools

Documentation

API reference

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

analyzer, analyzer_plugin, custom_lint_builder, nilts_core

More

Packages that depend on nilts_flutter_hooks