lookUpSelection method

Future<void> lookUpSelection(
  1. SelectionChangedCause cause
)

Look up the current selection, as in the "Look Up" edit menu button on iOS.

Currently this is only implemented for iOS.

Throws an error if the selection is empty or collapsed.

Implementation

Future<void> lookUpSelection(SelectionChangedCause cause) async {
  assert(!widget.obscureText);

  final String text = textEditingValue.selection.textInside(textEditingValue.text);
  if (widget.obscureText || text.isEmpty) {
    return;
  }
  await SystemChannels.platform.invokeMethod(
    'LookUp.invoke',
    text,
  );
}