findRichTextInParagraph static method
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.
By default, this method expects a single SuperEditor in the widget tree and
finds it byType
. To specify one SuperEditor among many, pass a superEditorFinder
.
Implementation
static TextSpan findRichTextInParagraph(String nodeId, [Finder? superEditorFinder]) {
final documentLayout = findDocumentLayout(superEditorFinder);
final component = documentLayout.getComponentByNodeId(nodeId) as DocumentComponent;
final superText = find
.descendant(of: find.byWidget(component.widget), matching: find.byType(SuperText))
.evaluate()
.single
.widget as SuperText;
return superText.richText as TextSpan;
}