toPlainText method

String toPlainText({
  1. bool includeSemanticsLabels = true,
  2. bool includePlaceholders = true,
})

Flattens the InlineSpan tree into a single string.

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'.

Implementation

String toPlainText({bool includeSemanticsLabels = true, bool includePlaceholders = true}) {
  final StringBuffer buffer = StringBuffer();
  computeToPlainText(buffer, includeSemanticsLabels: includeSemanticsLabels, includePlaceholders: includePlaceholders);
  return buffer.toString();
}