format method
Replaces the newlines and tabs of input and adds it to the stream.
Implementation
void format(String input,
{bool leadingSpace = true, bool trailingNewline = true}) {
final List<String> lines = input.split('\n');
for (int i = 0; i < lines.length; ++i) {
final String line = lines[i];
if (i == 0 && !leadingSpace) {
add(line.replaceAll('\t', tab));
} else if (line.isNotEmpty) {
write(line.replaceAll('\t', tab));
}
if (trailingNewline || i < lines.length - 1) {
addln('');
}
}
}