I having long string with interpolation in code. I am writing it as:
"""
$a: aaaaa
$b: bbbbb
$c: ccccc
"""
I do not want to write it in one line because readability. But in Text
widget it displays also in column:
How to prevent line breaking?
If you use a multi-line string literal, then you will get newlines in the string. You can remove them by doing:
var string = """
$a: aaaaa
$b: bbbbb
$c: ccccc
""".removeAll("\n");
That should leave you without any newlines.
Alternatively you can use multiple adjacent string literals instead:
var string =
"$a: aaaa"
"$b: bbbb"
"$c: cccc";
Adjacent string literals are combined into a single string value, and there are no extra newlines (if you want them, you have to add \n
yourself). You also don't have to worry about leading whitespace on the lines.