indent method
Adds indentation to the beginning of every line in the string.
Useful for formatting code blocks, creating nested structures in output, or indenting multi-line log messages.
Example:
'line1\nline2'.indent(' ') // ' line1\n line2'
'a\nb\nc'.indent('> ') // '> a\n> b\n> c'
Implementation
String indent(String indentation) {
if (isEmpty) return this;
final lines = split('\n');
return lines.map((line) => indentation + line).join('\n');
}