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

nilts_clock provides lint rules, quick fixes, and assists for Dart and Flutter projects using the [clock](https://pub.dev/packages/clock) package to help you enforce best practices and prevent errors.

nilts_clock #

nilts_clock provides lint rules, quick fixes, and assists for Dart and Flutter projects using the clock package to help you enforce best practices and prevent errors.

build pub license


Contents #

Usage #

Note: nilts_clock no longer supports custom_lint. If you're using custom_lint, please use nilts_clock versions below v1.0 and refer to README_CUSTOM_LINT.md.

If you're using Dart SDK version 3.10 or later, add nilts_clock to the top-level plugins section of your analysis_options.yaml file:

plugins:
  nilts_clock: ^1.0.0

Configuration #

All lint rules in nilts_clock are disabled by default.

To enable all rules, use the include directive with the provided configuration file.

Always use the latest

include: package:nilts_clock/analysis_options_all.yaml

Pin to a specific version

include: package:nilts_clock/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_clock:
    version: ^1.0.0
    diagnostics:
      using_date_time_now: 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.

Quick fix demo

Overview #

Rule name Overview Target SDK Rule type Maturity level Severity Quick fix
using_date_time_now Checks if DateTime.now() is used. Any versions nilts_clock supports ErrorProne Stable Info ✅️

Details #

using_date_time_now

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

DON'T use DateTime.now().

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

BAD:

final dateTimeNow = DateTime.now();

GOOD:

final clockNow = clock.now();

See also:

Assists #

Coming soon... 🚀

Feature requests #

Have a feature request? Please create an issue using this template.

Bug reports #

Found a bug? Please create an issue using this template.

Contributing #

Contributions are welcome! Please read the CONTRIBUTING guide before submitting your PR.

1
likes
140
points
191
downloads

Publisher

verified publisherronnnnn.com

Weekly Downloads

nilts_clock provides lint rules, quick fixes, and assists for Dart and Flutter projects using the [clock](https://pub.dev/packages/clock) package to help you enforce best practices and prevent 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

analysis_server_plugin, analyzer, analyzer_plugin, nilts_core

More

Packages that depend on nilts_clock