readImage static method

Future<Uint8List?> readImage()

Returns the image currently on the system clipboard as raw bytes (PNG on iOS / macOS / Windows / Android), or null if no image is available.

On macOS the call also handles TIFF clipboards by transcoding to PNG, and on Windows a bitmap (CF_DIBV5 or CF_DIB); Android resolves content:// URIs through ContentResolver and returns the underlying image bytes verbatim. Never throws — channel failures resolve to null.

Implementation

static Future<Uint8List?> readImage() async {
  try {
    final bytes = await _channel.invokeMethod<Uint8List>('readImage');
    return bytes;
  } on PlatformException {
    return null;
  } on MissingPluginException {
    return null;
  }
}