findDocumentLayout static method

DocumentLayout findDocumentLayout([
  1. Finder? superEditorFinder
])

Finds the DocumentLayout that backs a SuperEditor in the widget tree.

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 DocumentLayout findDocumentLayout([Finder? superEditorFinder]) {
  late final Finder layoutFinder;
  if (superEditorFinder != null) {
    layoutFinder = find.descendant(of: superEditorFinder, matching: find.byType(SingleColumnDocumentLayout));
  } else {
    layoutFinder = find.byType(SingleColumnDocumentLayout);
  }
  final documentLayoutElement = layoutFinder.evaluate().single as StatefulElement;
  return documentLayoutElement.state as DocumentLayout;
}