Reputation: 33
I'm using SelectableText widget to make Text selectable. But I don't know how to get the selected text and log it to console.
Upvotes: 1
Views: 2114
Reputation: 330
You can add the ToolbarOptions
inside your SelectableText
with copy: true
and then read the data from the clipboard.
SelectableText(
'your text',
toolbarOptions: ToolbarOptions(copy: true)
);
Here is an answered question about the clipboard: Flutter can't read from Clipboard
Edits: Clean up the answer and add more info.
Upvotes: 1