getData method

Future<ClipboardData> getData (String format)

Retrieves data from the clipboard that matches the given format.

The format argument specifies the media type, such as text/plain, of the data to obtain.

Returns a future which completes to null if the data could not be obtained, and to a ClipboardData object if it could.

Implementation

static Future<ClipboardData> getData(String format) async {
  final Map<String, dynamic> result = await SystemChannels.platform.invokeMethod(
    'Clipboard.getData',
    format,
  );
  if (result == null)
    return null;
  return ClipboardData(text: result['text']);
}