目次

不要な文字列補間

不要な文字列補間です。

このルールはDart 2.8以降で使用できます。

ルールセット: 推奨flutter

このルールにはクイックフィックスが用意されています。

詳細

#

しないでください 文字列式のみが含まれている場合は、文字列補間を使用しないでください。

悪い例

dart
String message;
String o = '$message';

良い例

dart
String message;
String o = message;

使用方法

#

unnecessary_string_interpolationsルールを有効にするには、analysis_options.yamlファイルのlinter > rulesの下にunnecessary_string_interpolationsを追加します。

analysis_options.yaml
yaml
linter:
  rules:
    - unnecessary_string_interpolations