indent function

String indent(
  1. String text,
  2. int level, {
  3. String char = ' ',
})

Indent every line of text by level repetitions of char.

Implementation

String indent(String text, int level, {String char = '  '}) {
  final prefix = char * level;
  return text.split('\n').map((l) => '$prefix$l').join('\n');
}