You can put the value of an expression inside a string by usingexpression}. If the expression is an identifier, you can skipthe {}. To get the string corresponding to an object, Dart calls theobject’s toString() method.

    1. var s = 'string interpolation';
    2. assert('Dart has $s, which is very handy.' ==
    3. 'Dart has string interpolation, ' +
    4. 'which is very handy.');
    5. assert('That deserves all caps. ' +
    6. '${s.toUpperCase()} is very handy!' ==
    7. 'That deserves all caps. ' +

    Note: The == operator tests whether two objects are equivalent. Two strings are equivalent if they contain the same sequence of code units.

    Another way to create a multi-line string: use a triple quote witheither single or double quotation marks:

    1. You can create
    2. multi-line strings like this one.
    3. ''';
    4. var s2 = """This is also a
    5. multi-line string.""";

    You can create a “raw” string by prefixing it with r:

    Literal strings are compile-time constants,as long as any interpolated expression is a compile-time constantthat evaluates to null or a numeric, string, or boolean value.

    1. // These work in a const string.
    2. const aConstBool = true;
    3. // These do NOT work in a const string.
    4. var aNum = 0;
    5. var aBool = true;
    6. var aString = 'a string';
    7. const aConstList = [1, 2, 3];
    8. const validConstString = '$aConstNum $aConstBool $aConstString';
    9. // const invalidConstString = '$aNum $aBool $aString $aConstList';

    For more information on using strings, see.