目录

dangling_library_doc_comments

Attach library doc comments to library directives.

此规则自 Dart 2.19 版本起可用。

_规则集:core , recommended , flutter _

此规则提供 快速修复

详情

#

Attach library doc comments (with ///) to library directives, rather than leaving them dangling near the top of a library.

BAD:

dart
/// This is a great library.
import 'package:math';
dart
/// This is a great library.

class C {}

GOOD:

dart
/// This is a great library.
library;

import 'package:math';

class C {}

NOTE: An unnamed library, like library; above, is only supported in Dart 2.19 and later. Code which might run in earlier versions of Dart will need to provide a name in the library directive.

使用方法

#

要启用 dangling_library_doc_comments 规则,请在你的 analysis_options.yaml 文件中,在 linter > rules 下添加 dangling_library_doc_comments

analysis_options.yaml
yaml
linter:
  rules:
    - dangling_library_doc_comments