1

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks @Andrei Caisim. Is there any way to make this by default...i mean when user tap on the text, instead of poping copy button, by default it should copy.
I don't know if this is possible, as I cannot see any controller or listener that listens to how much of the text is selected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.