findDocument static method

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

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

By default, this method expects a single SuperReader in the widget tree and finds it byType. To specify one SuperReader among many, pass a superDocumentFinder.

Implementation

static Document? findDocument([Finder? finder]) {
  final element = (finder ?? find.byType(SuperReader)).evaluate().single as StatefulElement;
  final superDocument = element.state as SuperReaderState;
  return superDocument.document;
}