prefer_double_quotes
Unnecessary use of single quotes.
Description
#The analyzer produces this diagnostic when a string literal uses single
quotes ('
) when it could use double quotes ("
) without needing extra
escapes and without hurting readability.
Example
#The following code produces this diagnostic because the string literal uses single quotes but doesn't need to:
dart
void f(String name) {
print('Hello $name');
}
Common fixes
#Use double quotes in place of single quotes:
dart
void f(String name) {
print("Hello $name");
}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。