nilts 0.1.0-dev.1 copy "nilts: ^0.1.0-dev.1" to clipboard
nilts: ^0.1.0-dev.1 copied to clipboard

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

nilts #

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


Appendix #

Usage #

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

dev_dependencies:
  custom_lint: <version>
  nilts: <version>

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

analyzer:
  plugins:
    - custom_lint

Configuration #

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

Disabling strategy #

All of nilts 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.
    - use_media_query_xxx_of: false

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:
    - use_media_query_xxx_of: true

NOTE: If you enable_all_lint_rules set to false, all of lint rules (not only all of nilts'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
use_media_query_xxx_of Checks MediaQuery.xxxOf(context) or MediaQuery.maybeXxxOf(context) usages. >= Flutter 3.10.0 (Dart 3.0.0) Practice Experimental ✅️

Details #

use_media_query_xxx_of

  • Target SDK: >= Flutter 3.10.0 (Dart 3.0.0)
  • Rule type: Practice
  • Maturity level: Experimental
  • Quick fix: ✅

Prefer using MediaQuery.xxxOf(context) or MediaQuery.maybeXxxOf(context) instead of MediaQuery.of(context) or MediaQuery.maybeOf(context) to avoid unnecessary rebuilds.

BAD:

final size = MediaQuery.of(context).size;

GOOD:

final size = MediaQuery.sizeOf(context);

Note that using MediaQuery.of(context) or MediaQuery.maybeOf(context) makes sense in case of observing MediaQueryData object changes or referring to many properties of MediaQueryData.

See also:

Assists #

Upcoming... 🚀

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.

9
likes
0
points
656
downloads

Publisher

verified publisherronnnnn.com

Weekly Downloads

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

Repository (GitHub)
View/report issues

Topics

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

License

unknown (license)

Dependencies

analyzer, analyzer_plugin, custom_lint_builder, meta

More

Packages that depend on nilts