library_ prefixes
Learn about the library_prefixes linter rule.
Use lowercase_with_underscores when specifying a
library prefix.
Details
#
DO use
lowercase_with_underscores when specifying a
library prefix.
BAD:
import 'dart:math' as Math;
import 'dart:json' as JSON;
import 'package:js/js.dart' as JS;
import 'package:javascript_utils/javascript_utils.dart' as jsUtils;
GOOD:
import 'dart:math' as math;
import 'dart:json' as json;
import 'package:js/js.dart' as js;
import 'package:javascript_utils/javascript_utils.dart' as js_utils;
Enable
#
To enable the library_prefixes rule, add
library_prefixes under
linter > rules in your
analysis_options.yaml
file:
linter:
rules:
- library_prefixes
If you're instead using the YAML map syntax to configure
linter rules, add library_prefixes: true under
linter > rules:
linter:
rules:
library_prefixes: true
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.