indenting_buffer 1.0.0 indenting_buffer: ^1.0.0 copied to clipboard
A StringBuffer derivative that supports identation.
indenting_buffer #
A StringBuffer derivative that supports indentation.
Usage #
Example of writing a nicely-formatted function:
main() {
var js = new IndentingBuffer()..writeln('function main() {');
js.indent()
..writeln('var x = "Hello, world!";')
..writeln('window.alert(x);');
js.outdent().writeln('}');
print(js);
}
Output:
function main() {
var x = "Hello, world!";
window.alert(x);
}
You can write text that ignores indentation:
direct() => buf.withoutIndentation('<some-text>');