toFormattedString method
String
toFormattedString({
- int nestingLevel = 0,
- String indent = '\t',
- bool encodeCharacterEntities = true,
- String? encodeCharacters,
- bool doubleQuotes = true,
override
Returns this node as a formatted string.
Each child is returned further indented by indent
with
each nestingLevel
.
If lineLength
isn't null
, lines will be broken when they
reach lineLength
in length. Some lines may not be broken
by lineLength
if a clean way to break them can't be detected.
nestingLevel
must not be null
and must be >= 0
.
indent
defaults to \t
(tab) and must not be null
.
lineLength
must not be null
and must be > 0
.
Implementation
@override
String toFormattedString({
int nestingLevel = 0,
String indent = '\t',
bool encodeCharacterEntities = true,
String? encodeCharacters,
bool doubleQuotes = true,
}) {
assert(nestingLevel >= 0);
var doctype = _getTag(doubleQuotes);
if (internalDtd != null) {
doctype += ' [\n';
doctype += internalDtd!.format(
nestingLevel: nestingLevel,
indent: indent,
encodeCharacterEntities: encodeCharacterEntities,
encodeCharacters: encodeCharacters,
doubleQuotes: doubleQuotes,
);
doctype += '${(indent * nestingLevel)}]';
}
doctype += '>\n';
return doctype;
}