String variable_name = 'value' //OR String variable_name = ''value'' //OR String variable_name = '''line1 line2''' //OR String variable_name= """line1 line2"""
Example
void main() {
String str1 = 'hello';
String str2 = "hello";
String str3 = '''hello world''';
String str4 = """hello world""";
print(str1);
print(str2);
print(str3);
print(str4);
}
It will produce the following Output −
hello hello hello world hello world
# String Interpolation
void main() {
String str1 = "hello";
String str2 = "world";
String res = str1 +str2;
print("The concatenated string : ${res}");
}
=> output
The concatenated string : Hello world