unnecessary_library_directive

Group: style

Maturity: stable

Dart SDK: >= 2.19.0 • (Linter v1.29.0)

Since info is static, may be stale
has-fix

View all Lint Rules

Using the Linter

DO use library directives if you want to document a library and/or annotate a library.

BAD:

library;

GOOD:

/// This library does important things
library;
@TestOn('js')
library;

NOTE: Due to limitations with this lint, libraries with parts will not be flagged for unnecessary library directives.

Usage

To enable the unnecessary_library_directive lint, add unnecessary_library_directive under linter > rules in your analysis_options.yaml file:

linter:
  rules:
    - unnecessary_library_directive