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

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

nilts_clock #

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

build pub license


Contents #

Usage #

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

dev_dependencies:
  custom_lint: <version>
  nilts_clock: <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_clock in analysis_options.yaml file. Choice one of the following configuration strategies.

Disabling strategy #

All of nilts_clock 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_clock'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
using_date_time_now Checks if DateTime.now() is used. Any versions nilts_clock supports ErrorProne Experimental ✅️

Details #

using_date_time_now

  • Target SDK : Any versions nilts_clock supports
  • Rule type : ErrorProne
  • Maturity level : Experimental
  • Quick fix : ✅

DON'T use DateTime.now().

If your project depends on clock package and expects current time is encapsulated, always use clock.now() instead for consistency.

BAD:

final dateTimeNow = DateTime.now();
copied to clipboard

GOOD:

final clockNow = clock.now();
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
101
downloads

Publisher

verified publisherronnnnn.com

Weekly Downloads

2024.09.21 - 2025.04.05

nilts_clock is lint rules, quick fixes and assists for Dart and Flutter projects using clock 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_clock