目次

隣接文字列連結の推奨

文字列リテラルを連結するには、隣接文字列を使用してください。

このルールは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 > rulesprefer_adjacent_string_concatenationを追加します。

analysis_options.yaml
yaml
linter:
  rules:
    - prefer_adjacent_string_concatenation