unnecessary_library_directive
Avoid library directives unless they have documentation comments or annotations.
This rule is available as of Dart 2.19.
This rule has a quick fix available.
Details
#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
rule, add unnecessary_library_directive
under linter > rules in your analysis_options.yaml
file:
linter:
rules:
- unnecessary_library_directive
Unless stated otherwise, the documentation on this site reflects Dart 3.5.4. Page last updated on 2024-07-03. View source or report an issue.