searchWebForSelection method
- SelectionChangedCause cause
Launch a web search on the current selection, as in the "Search Web" edit menu button on iOS.
Currently this is only implemented for iOS.
When 'obscureText' is true or the selection is empty, this function will not do anything
Implementation
Future<void> searchWebForSelection(SelectionChangedCause cause) async {
assert(!widget.obscureText);
if (widget.obscureText) {
return;
}
final String text = textEditingValue.selection.textInside(textEditingValue.text);
if (text.isNotEmpty) {
await SystemChannels.platform.invokeMethod(
'SearchWeb.invoke',
text,
);
}
}