Search⌘ K

String Interpolation

Explore how Dart's string interpolation allows you to embed expressions within strings for concise and flexible code. This lesson covers syntax, examples, and how to handle multi-line strings, helping you write clearer and more efficient Dart code.

String Concatenation

To concatenate two strings means to join them together. Concatenation of two or more strings is done using the + operator.

Dart
main() {
String s1 = "First half of the string. ";
String s2 = "Second half of the string";
print(s1 + s2);
}

The code above is pretty simple. On line 4 we are concatenating the first string, s1, and the second string, s2, and then printing the concatenated string.

String interpolation

String interpolation is the ability to create new strings or ...