computeToPlainText method Null safety
- StringBuffer buffer,
- {bool includeSemanticsLabels = true,
- bool includePlaceholders = true}
override
Walks the InlineSpan tree and writes the plain text representation to buffer
.
This method should not be directly called. Use toPlainText instead.
Styles are not honored in this process. If includeSemanticsLabels
is
true, then the text returned will include the TextSpan.semanticsLabels
instead of the text contents for TextSpans.
When includePlaceholders
is true, PlaceholderSpans in the tree will be
represented as a 0xFFFC 'object replacement character'.
The plain-text representation of this InlineSpan is written into the buffer
.
This method will then recursively call computeToPlainText on its children
InlineSpans if available.
Implementation
@override
void computeToPlainText(
StringBuffer buffer, {
bool includeSemanticsLabels = true,
bool includePlaceholders = true,
}) {
assert(debugAssertIsValid());
if (semanticsLabel != null && includeSemanticsLabels) {
buffer.write(semanticsLabel);
} else if (text != null) {
buffer.write(text);
}
if (children != null) {
for (final InlineSpan child in children!) {
child.computeToPlainText(buffer,
includeSemanticsLabels: includeSemanticsLabels,
includePlaceholders: includePlaceholders,
);
}
}
}