flutter allow user to select text

The solution for “flutter allow user to select text” can be found here. The following code will assist you in solving the problem.

//Give your scaffold a key defined like so
GlobalKey _scaffoldKey = GlobalKey();

/// Pastes given String to the clipboard and shows Popup-Snackbar
void copyToClipboard(String toClipboard) {
ClipboardData data = new ClipboardData(text: toClipboard);
Clipboard.setData(data);
_scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text(toClipboard + ‘ copied to clipboard.’),
));
}

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in