Skip to main content

prefer_adjacent_string_concatenation

String literals shouldn't be concatenated by the '+' operator.

Description

#

The analyzer produces this diagnostic when the + operator is used to concatenate two string literals.

Example

#

The following code produces this diagnostic because two string literals are being concatenated by using the + operator:

dart
var s = 'a' + 'b';

Common fixes

#

Remove the operator:

dart
var s = 'a' 'b';