Group: style

Maturity: stable

Dart SDK: >= 2.0.0 • (Linter v0.1.33)

Since info is static, may be stale

View all Lint Rules

Using the Linter

DO use single quotes where they wouldn't require additional escapes.

That means strings with an apostrophe may use double quotes so that the apostrophe isn't escaped (note: we don't lint the other way around, ie, a single quoted string with an escaped apostrophe is not flagged).

It's also rare, but possible, to have strings within string interpolations. In this case, its much more readable to use a double quote somewhere. So double quotes are allowed either within, or containing, an interpolated string literal. Arguably strings within string interpolations should be its own type of lint.


    "should be single quote",
    r"should be single quote",
    r"""should be single quotes""")


    'should be single quote',
    r'should be single quote',
    r'''should be single quotes''',
    "here's ok",
    "nested ${a ? 'strings' : 'can'} be wrapped by a double quote",
    'and nested ${a ? "strings" : "can be double quoted themselves"}');

Incompatible with: prefer_double_quotes.