findRichTextInParagraph static method

TextSpan findRichTextInParagraph(
  1. String nodeId, [
  2. Finder? superReaderFinder
])

Finds the paragraph with the given nodeId and returns the paragraph's content as a TextSpan.

A TextSpan is the fundamental way that Flutter styles text. It's the lowest level reflection of what the user will see, short of rendering the actual UI.

Implementation

static TextSpan findRichTextInParagraph(String nodeId, [Finder? superReaderFinder]) {
  final documentLayout = _findDocumentLayout(superReaderFinder);

  final textComponentState = documentLayout.getComponentByNodeId(nodeId)!;
  final superText = find
      .descendant(of: find.byWidget(textComponentState.widget), matching: find.byType(SuperText))
      .evaluate()
      .single
      .widget as SuperText;
  return superText.richText as TextSpan;
}