メインコンテンツにスキップ

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 マップ構文を使用してリンタールールを設定している場合は、linter > rules の下に prefer_adjacent_string_concatenation: true を追加してください。

analysis_options.yaml
yaml
linter:
  rules:
    prefer_adjacent_string_concatenation: true