indentBlock method

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

Indents every line of text by level repetitions of char.

Implementation

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