flutter allow user to select text code example
Example: flutter allow user to select text
//Give your scaffold a key defined like so
GlobalKey<ScaffoldState> _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.'),
));
}