目录

prefer_adjacent_string_concatenation

使用相邻字符串连接字符串字面量。

此规则从 Dart 2.0 开始可用。

规则集:推荐flutter

此规则有可用的快速修复

详情

#

应该使用相邻字符串连接字符串字面量。

错误

dart
raiseAlarm(
    'ERROR: Parts of the spaceship are on fire. Other ' +
    'parts are overrun by martians. Unclear which are which.');

正确

dart
raiseAlarm(
    'ERROR: Parts of the spaceship are on fire. Other '
    'parts are overrun by martians. Unclear which are which.');

用法

#

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

analysis_options.yaml
yaml
linter:
  rules:
    - prefer_adjacent_string_concatenation