desktop_drop
0.9.2, released 4 weeks ago by mixin.dev
Receive dragged files, directories, text, and URLs into Flutter apps
What it does
Allows Flutter applications to accept drag-and-drop operations for files, directories, text, and URLs. Provides configurable drop targets with support for MIME-type filtering, custom acceptance logic, and cross-platform native integration.
AI-written summary of version 0.9.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- Building desktop or multi-platform apps that need to accept dragged files
- Implementing custom file drop zones with specific MIME-type requirements
Skip it when
- You only need a traditional file picker dialog rather than drag-and-drop
Strengths
- Supports multiple platforms including Windows, macOS, Linux, Web, Android, and iOS
- Typed drop items for files, directories, and strings with MIME type info
- Per-target drag acceptance and nested target fallback support
Weaknesses
- Provider access and temporary files are strictly bound to the lifetime of the onDrop callback
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 5
Requires Flutter 3.47.7 / Dart 3.13.5 or later. For macOS secondary windows using desktop_multi_window, manual plugin registration is needed.
import 'package:desktop_drop/desktop_drop.dart';
DropTarget(
acceptedKinds: const {DropItemKind.file},
onDrop: (details) async {
for (final item in details.items.whereType<DropFileItem>()) {
final bytes = await item.file.readAsBytes();
print('${item.name}: ${bytes.length} bytes');
}
},
child: const SizedBox(width: 200, height: 200),
)Alternatives
Packages that do the same job and could replace desktop_drop.
- receive_sharing_intent
Receives shared photos, videos, text, and files from other apps.
83Compare - flutter_sharing_intent
Receive shared photos, videos, text, and files from other apps.
76Compare - listen_sharing_intent
Flutter plugin to receive shared photos, videos, text, URLs, or files from other apps.
57Compare - appinio_social_share
Supports sharing text, images, files, and text with images to social media apps.
78Compare
Works with
Packages commonly used together with desktop_drop: ones it builds on, ones built on it, and its own family.
- mimedesktop_drop depends on itUtilities to resolve MIME types from file names, magic bytes, and to parse multipart streams.
- webdesktop_drop depends on itLightweight bindings for browser APIs via JS interop
- cross_filedesktop_drop depends on itAn abstraction to allow working with files across multiple platforms.
- desktop_webview_windowSame familyShow a native webview window on your Flutter desktop application.
- desktop_multi_windowSame familyCreate and manage multiple windows on desktop platforms in Flutter.
- desktop_lifecycleSame familyAllows Flutter desktop applications to perceive window activation state.
- stream_chat_flutterBuilt on desktop_dropFull-featured Flutter UI SDK for Stream Chat, providing ready‑made chat widgets and theming.