getData static method

Future<String?> getData()

Retrieves the text data from the clipboard. Returns null if no text data is present on the clipboard.

Implementation

static Future<String?> getData() async {
  var result = await Clipboard.getData(Clipboard.kTextPlain);
  if (result != null) {
    return result.text;
  } else {
    return null;
  }
}