Skip to content

[desktop_drop] Add macOS app-wide and text drops#485

Open
omar-hanafy wants to merge 1 commit into
MixinNetwork:mainfrom
omar-hanafy:desktop-drop-upstream-squash
Open

[desktop_drop] Add macOS app-wide and text drops#485
omar-hanafy wants to merge 1 commit into
MixinNetwork:mainfrom
omar-hanafy:desktop-drop-upstream-squash

Conversation

@omar-hanafy

@omar-hanafy omar-hanafy commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds macOS app-wide drop support to desktop_drop, including files/folders opened through Finder, Open With, or the Dock icon, plus selected text/link drops through macOS Services.

This also updates the package docs, changelog, and example app so the required macOS Info.plist and AppDelegate.swift wiring is visible in a working project.

Branch: desktop-drop-upstream-squash

What Changed

  • Added DropTarget.catchAppWideDrops so a primary drop target can receive app-wide macOS drops that do not hover over the Flutter view first.
  • Added buffering for launch-time app-wide drops until Dart and a listener/drop target are ready.
  • Added macOS Services handling for Dock text and link drops.
  • Added memory-backed DropItem support for dropped text/link payloads, plus helpers such as isMemoryBacked, isTextLike, readAsText(), and readAsUris().
  • Updated macOS native drop handling to process file URLs, file promises, directories, app open events, and text/link Services payloads through one delivery path.
  • Updated README setup docs for Finder/Dock file drops and Dock text/link drops.
  • Rebuilt the desktop_drop example app and wired the macOS example with the required CFBundleDocumentTypes, NSServices, and Services provider setup.
  • Prepared desktop_drop 0.8.0 changelog notes for the new user-facing behavior.

Why

The previous DropTarget path only handled drops that entered the Flutter view. On macOS, users can also send content to an app at the application level by dropping files on the Dock icon, using Finder Open With, or dropping selected text/links through Services. Those paths can arrive before the Flutter UI is ready and do not have normal hover coordinates, so they need explicit buffering and an opt-in delivery path.

Text/link drops also are not real file paths. They need to be exposed as memory-backed items with helper APIs so apps can distinguish them from filesystem drops and read their contents safely.

Validation

  • dart analyze packages/desktop_drop
  • flutter test packages/desktop_drop
  • Manually tested the macOS Dock/text drop behavior when the feature was originally built.

Notes

The example app changes are intentionally larger than the plugin surface because the existing example was old and needed to be regenerated to demonstrate the new macOS global drop setup clearly.

@omar-hanafy omar-hanafy force-pushed the desktop-drop-upstream-squash branch from c2a9fb3 to cf2aa14 Compare June 24, 2026 08:45
@omar-hanafy omar-hanafy marked this pull request as ready for review June 24, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant