paste method

Future<String?> paste()

Pastes the text from the clipboard.

Returns the text from the clipboard, or null if an error occurs or the clipboard is empty.

Implementation

Future<String?> paste() async {
  try {
    ClipboardData? clipboardData = await Clipboard.getData(Clipboard.kTextPlain);
    return clipboardData?.text;
  } catch (e) {
    print('Error: $e');
    return null;
  }
}