XClipboard class

OS clipboard access for shapes Flutter's Clipboard doesn't cover. Image bytes and copied files — the system text path is already handled by the SDK's Clipboard.getData(Clipboard.kTextPlain).

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

hasMedia() → Future<bool>
Whether the clipboard currently holds media this class can paste — an image on any platform, copied files on macOS and Windows. Type-level check only: it never reads clip contents, so it triggers neither iOS's paste-permission prompt nor Android 12+'s paste toast. Drives paste affordances (e.g. showing a Paste menu item for an image-only clipboard, which the text-oriented Clipboard.hasStrings misses).
readFiles() → Future<List<XClipboardFile>>
Files currently on the system clipboard (a Finder / Explorer "Copy"), on macOS and Windows — other platforms (and channel failures) resolve to an empty list. Check this BEFORE readImage: a copied file may also expose a thumbnail image on the pasteboard, and the file is the user's intent.
readImage() → Future<Uint8List?>
Returns the image currently on the system clipboard as raw bytes (PNG on iOS / macOS / Windows / Android), or null if no image is available.