prefer_adjacent_string_concatenation
使用相邻字符串来连接字符串字面量。
详情
#请 使用相邻字符串来连接字符串字面量。
不好
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
如果你使用的是 YAML map 语法来配置 linter 规则,请在 linter > rules 下添加 prefer_adjacent_string_concatenation: true
analysis_options.yaml
yaml
linter:
rules:
prefer_adjacent_string_concatenation: true