shareSelection method
Launch the share interface for the current selection, as in the "Share..." edit menu button on iOS.
Currently this is only implemented for iOS and Android.
When 'obscureText' is true or the selection is empty, this function will not do anything
Implementation
Future<void> shareSelection(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(
'Share.invoke',
text,
);
}
}