getData static method

Future<ClipboardData?> getData(
  1. 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.


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