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.
no setterinherited
- isEmpty → bool
-
Returns whether the buffer is empty. This is a constant-time operation.
no setteroverride
- isNotEmpty → bool
-
Returns whether the buffer is not empty. This is a constant-time
operation.
no setteroverride
- lastLine → CodeBufferLine?
-
The last line created within this buffer.
no setter
- length → int
-
Returns the length of the content that has been accumulated so far.
This is a constant-time operation.
no setteroverride
-
lines
→ List<
CodeBufferLine> -
Returns an immutable collection of the
CodeBufferLine
s within this instance.no setter - newline → String
-
The character sequence used to represent a line break.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- 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 nonexistent 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 -
Writes the string representation of
object
.override -
writeAll(
Iterable objects, [String separator = '']) → void -
Writes the elements of
objects
separated byseparator
.override -
writeCharCode(
int charCode) → void -
Writes a string containing the character with code point
charCode
.override -
writeln(
[Object? obj = '']) → void -
Writes the string representation of
object
followed by a newline.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited