prefer_single_quotes
Details about the 'prefer_single_quotes' diagnostic produced by the Dart analyzer.
Unnecessary use of double quotes.
Description
#
The analyzer produces this diagnostic when a string literal uses double
quotes (") when it could use single quotes (') without needing extra
escapes and without hurting readability.
Example
#The following code produces this diagnostic because the string literal uses double quotes but doesn't need to:
void f(String name) {
print("Hello $name");
}
Common fixes
#Use single quotes in place of double quotes:
void f(String name) {
print('Hello $name');
}
除非另有说明,文档之所提及适用于 Dart 3.10.3 版本报告页面问题.