Skip to content
pubscout

desktop_drop

0.9.2, released 4 weeks ago by mixin.dev

Receive dragged files, directories, text, and URLs into Flutter apps

WASM-ready
$ flutter pub add desktop_drop
Source repository

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.

Works with

Packages commonly used together with desktop_drop: ones it builds on, ones built on it, and its own family.