內容

unnecessary_string_escapes

移除字串中不必要的反斜線。

此規則自 Dart 2.8 起可用。

規則集:recommendedflutter

此規則有可用的快速修正

詳細資料

#

移除字串中不必要的反斜線。

不良範例

dart
'this string contains 2 \"double quotes\" ';
"this string contains 2 \'single quotes\' ";

良好範例

dart
'this string contains 2 "double quotes" ';
"this string contains 2 'single quotes' ";

用法

#

若要啟用 unnecessary_string_escapes 規則,請在您的 analysis_options.yaml 檔案中的 linter > rules 下方新增 unnecessary_string_escapes

analysis_options.yaml
yaml
linter:
  rules:
    - unnecessary_string_escapes