Skip to main content

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");
}