writeIndented method

void writeIndented(
  1. int indentation, [
  2. Object? object
])

Adds object, indented by indentation, to this buffer.

final buffer = StringBuffer()..writeIndented(4, 'hello world');
buffer.toString(); // '    hello world'

Implementation

void writeIndented(int indentation, [Object? object]) => this..write(' ' * indentation)..write(object);