CodeBuffer class

An advanced StringBuffer geared toward generating code, and source maps.

Implemented types

Constructors

CodeBuffer({String space = ' ', String newline = '\n', bool trailingNewline = false, dynamic sourceUrl})
CodeBuffer.noWhitespace({dynamic sourceUrl})
Creates a CodeBuffer that does not emit additional whitespace.
factory

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
isEmpty bool
Returns whether the buffer is empty. This is a constant-time operation.
read-only, override
isNotEmpty bool
Returns whether the buffer is not empty. This is a constant-time operation.
read-only, override
lastLine CodeBufferLine
The last line created within this buffer.
read-only
length int
Returns the length of the content that has been accumulated so far. This is a constant-time operation.
read-only, override
lines List<CodeBufferLine>
Returns an immutable collection of the CodeBufferLines within this instance.
read-only
newline String
The character sequence used to represent a line break.
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
sourceUrl → dynamic
The source URL to be applied to all generated SourceSpan instances.
final
space String
The character sequence used to represent a space/tab.
final
trailingNewline bool
If true (default: false), then an additional newline will be inserted at the end of the generated string.
final

Methods

clear() → void
Clears the string buffer.
override
copyInto(CodeBuffer other) → void
Copies the contents of this CodeBuffer into another, preserving indentation and source mapping information.
indent() → void
Increments the indentation level.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
outdent() → void
Decrements the indentation level, if it is greater than 0.
toString() String
A string representation of this object. [...]
override
write(Object obj) → void
Adds the string representation of object to the buffer.
override
writeAll(Iterable objects, [String separator = ""]) → void
Writes all objects separated by separator. [...]
override
writeCharCode(int charCode) → void
Adds the string representation of charCode to the buffer. [...]
override
writeln([Object obj = ""]) → void
Writes object followed by a newline, "\n". [...]
override

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited