copyToClipboard static method

Future<bool> copyToClipboard(
  1. String text
)

Copies text to clipboard

Returns true if successful, false otherwise

Implementation

static Future<bool> copyToClipboard(String text) async {
  try {
    await Clipboard.setData(ClipboardData(text: text));
    return true;
  } catch (e) {
    // Log error or handle it as needed
    return false;
  }
}