findSelection static method

TextSelection? findSelection([
  1. Finder? superTextFieldFinder
])

Finds and returns the TextSelection within a SuperTextField.

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

Implementation

static TextSelection? findSelection([Finder? superTextFieldFinder]) {
  final finder = superTextFieldFinder ?? find.byType(SuperTextField);
  final element = finder.evaluate().single as StatefulElement;
  final state = element.state as SuperTextFieldState;
  return state.controller.selection;
}