hasFocus static method

bool hasFocus([
  1. Finder? finder
])

Returns true if the given SuperEditor widget currently has focus, or false otherwise.

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