prefer_adjacent_string_concatenation
使用相鄰字串來串連字串字面值。
此規則自 Dart 2.0 起可用。
此規則有可用的快速修正。
詳細資料
#應該使用相鄰字串來串連字串字面值。
錯誤
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
除非另有說明,否則本網站上的文件反映的是 Dart 3.6.0。頁面最後更新於 2024-07-03。 檢視原始碼 或 回報問題。