As you might recall, Dart is removing support for concatenating strings with the + operator. In its place, the team has added support for "adjacent string literals". This new functionality is now available in Dart VM, Frog, and the Editor.
It turns out that puzzles arise from the using + to concatenate strings, so the Dart team felt compelled to take a fresh approach. Dart already had string interpolation, which allows you to embed a string within a string:
// String interpolation in Dart
String to = 'Bob';
String msg = "Hello $to"; // Hello Bob
Dart also has multi-line Strings, using triple quotes:
String htmlTemplate = """
<div>
<p>
Hello $to.
</p>
</div>""";
Sometimes, however, you need to deal with very long strings. You used to use the + operator to concat long strings, but the new way is to use adjacent string literals.
// Old 'n busted way to concat long strings in Dart
String longMessage = 'This is what you used to do in Dart. ' +
'You would use the + operator ' +
'to concat strings. Just like we are ' +
'doing here, in fact.';
// The new hotness
String longMessage = 'This is what you used to do in Dart. '
'You would use the + operator '
'to concat strings. Just like we are '
'doing here, in fact.';
Summary
The recommendation is to stop using + to concatenate strings and begin to refactor the old code to use adjacent string literals and string interpolation.
As always, the Dart team is very interested in your comments, please join the mailing list to share your experiences.