unnecessary_string_escapes
移除字串中不必要的反斜線。
此規則自 Dart 2.8 起可用。
規則集:recommended、flutter
此規則有可用的快速修正。
詳細資料
#移除字串中不必要的反斜線。
不良範例
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
除非另有說明,否則本網站的文件反映的是 Dart 3.6.0。頁面最後更新於 2024-07-03。 檢視原始碼或回報問題。