findDocumentSelection static method

DocumentSelection? findDocumentSelection([
  1. Finder? finder
])

Returns the current DocumentSelection for 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 DocumentSelection? findDocumentSelection([Finder? finder]) {
  final element = (finder ?? find.byType(SuperReader)).evaluate().single as StatefulElement;
  final superDocument = element.state as SuperReaderState;
  return superDocument.selection;
}