copyToClipboard function
Copies the specified text to the system clipboard.
Parameters:
text(String): The text to copy to the clipboard.
Returns:
Future<bool>: A future that completes withtrueif the copy operation succeeded, orfalseif an error occurred.
Implementation
Future<bool> copyToClipboard(String text) async {
try {
await Clipboard.setData(ClipboardData(text: text));
return true;
} catch (e) {
return false;
}
}