Windows-only Flutter plugin that handles native OLE drag-and-drop and clipboard
paste, including the TYMED_ISTORAGE transfer type used by Outlook Classic
when email items are dragged directly from the folder view.
Most existing Flutter drag-and-drop plugins (super_drag_and_drop,
desktop_drop, etc.) work great for normal files but silently drop Outlook
Classic email items because Outlook delivers them as an OLE compound document
via TYMED_ISTORAGE — a transfer mode those plugins don't flatten.
This plugin handles all virtual-file transfer modes that real-world Windows apps use:
| Mode | Used by |
|---|---|
CF_HDROP |
Explorer, generic file drops |
TYMED_HGLOBAL |
Many in-memory drag sources |
TYMED_ISTREAM |
Outlook attachments, browser downloads |
TYMED_ISTORAGE |
Outlook Classic email items (.msg) |
The same OLE pipeline is also exposed via getClipboardFiles() so Ctrl+V
of an Outlook email Just Works.
The plugin registers an IDropTarget on the Flutter view HWND via
RegisterDragDrop. This means:
- It is incompatible with
super_drag_and_drop/desktop_dropwhen both try to own the same window's drop target. Use one or the other — not both. - Drop events stream back to Dart via an
EventChannel. - A handler stack lets modal dialogs override the page-level handler.
dependencies:
flutter_windows_native_drop:
git:
url: git@github.com:pd17481/flutter_windows_native_drop.git
ref: v0.1.0import 'package:flutter_windows_native_drop/flutter_windows_native_drop.dart';
@override
void initState() {
super.initState();
WindowsNativeDrop.pushHandler(
onDrop: (files) {
for (final f in files) {
debugPrint('Got ${f.name}: ${f.bytes.length} bytes');
}
},
onDragEnter: () => setState(() => _hover = true),
onDragLeave: () => setState(() => _hover = false),
);
}
@override
void dispose() {
WindowsNativeDrop.popHandler();
super.dispose();
}The handler stack means a dialog can push its own handler in initState and
pop it in dispose; the underlying page handler resumes automatically.
final files = await WindowsNativeDrop.getClipboardFiles();Returns whatever is on the clipboard in the same format as drop events. Useful for Ctrl+V of Outlook email items.
| Platform | Status |
|---|---|
| Windows | Supported |
| Other | All API calls are safe no-ops (return false / empty lists) |
WindowsNativeDrop.isSupported returns true only on Windows desktop.
MIT