readFiles static method
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.
Implementation
static Future<List<XClipboardFile>> readFiles() async {
try {
final raw = await _channel.invokeListMethod<Object?>('readFiles');
if (raw == null) return const [];
return [
for (final entry in raw)
if (entry is Map)
XClipboardFile(
path: entry['path']! as String,
name: entry['name']! as String,
bookmark: entry['bookmark'] as Uint8List?,
),
];
} on PlatformException {
return const [];
} on MissingPluginException {
return const [];
}
}