copyToClipboard static method
Copies the given text
to the clipboard and optionally shows a confirmation message
.
Implementation
static Future<void> copyToClipboard(String text, {String? message}) async {
try {
await Clipboard.setData(ClipboardData(text: text));
if (message != null) {
// Optionally show confirmation, e.g., using a Snackbar
Get.snackbar("", message); // Replace with a UI notification if needed
}
} catch (e) {
print("Failed to copy to clipboard: $e");
}
}