findDocument static method

Document? findDocument([
  1. Finder? finder
])

Returns the Document within the SuperEditor matched by finder, or the singular SuperEditor in the widget tree, if finder is null.

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 Document? findDocument([Finder? finder]) {
  final element = (finder ?? find.byType(SuperEditor)).evaluate().single as StatefulElement;
  final superEditor = element.state as SuperEditorState;
  return superEditor.editContext.editor.document;
}