file_drop 1.0.0
file_drop: ^1.0.0 copied to clipboard
Zero-dependency file selector and drag-and-drop plugin for Flutter across Android, iOS, Linux, macOS, Windows, and Web. Replaces file_selector and desktop_drop.
1.0.0 #
Initial stable release of file_drop — a unified, zero-dependency Flutter file selector and drag-and-drop plugin across Android, iOS, Linux, macOS, Windows, and Web / WebAssembly (dart2wasm).
Zero-Dependency 6-Platform Architecture #
- Eliminates all external hosted Pub, CocoaPods/SPM, CMake, and Gradle/Maven dependencies (
dependencies:contains only Flutter SDK packages:flutterandflutter_web_plugins), resolving version-solving conflicts betweenfile_selector(cross_file ^0.3.0+ 7 federated packages) anddesktop_drop(cross_file ^0.4.0+ 5 federated packages,mime,web;0.8.x:universal_platform,dbus,ffi). - Android (
Kotlin/ Storage Access Framework &View.OnDragListener, minSdk 24, AGP 8.x & 9.x Built-in Kotlin compatible): Zero-androidxSAF pickers (ACTION_OPEN_DOCUMENT,ACTION_CREATE_DOCUMENT,ACTION_OPEN_DOCUMENT_TREE), 256 KB chunkedContentResolverreadContentUristreaming,DocumentsContracttree listing, and multi-windowView.OnDragListener+Activity.requestDragAndDropPermissions. - iOS (
Swift/UIKit&UniformTypeIdentifiers, iOS 14.0+): Dual Swift Package Manager (Package.swift) and CocoaPods (file_drop.podspec) layout withPrivacyInfo.xcprivacy,UIDocumentPickerViewControlleropen/export/directory pickers,NSFileCoordinatorstaging, security-scoped bookmarks, and iOS/iPadOSUIDropInteractionDelegatedrag-and-drop. - Linux (
C++14/GTK3& XDG Desktop Portal,-Wall -Werrorclean): AsynchronousGtkFileChooserNativedialogs automatically backed byorg.freedesktop.portal.FileChooserwithout Dartdbusdependencies, plusgtk_drag_dest_set(text/uri-listand plain text) drag-and-drop across X11 and Wayland. - macOS (
Swift/AppKit&UniformTypeIdentifiers, macOS 11.0+): Dual Swift Package Manager (Package.swift) and CocoaPods (file_drop.podspec) layout withPrivacyInfo.xcprivacy, sheet/modalNSOpenPanelandNSSavePaneldialogs,UTTypecontent filtering,NSFilePromiseReceiverpromised files, and a resize-safe, non-interceptingNSDraggingDestinationview. - Windows (
C++17/Win32 COM&OLE,/W4 /WXclean): ModalIFileOpenDialogandIFileSaveDialogCOM dialogs attached to the root FlutterHWND, paired with a reference-countedIDropTarget+IDropTargetHelperOLE drag destination and per-monitor HiDPI coordinate scaling viaFlutterDesktopGetDpiForHWND. - Web & WebAssembly (
dart:js_interop/dart:js_interop_unsafe,dart2wasmclean): Conditional-import architecture isolatingdart:iofrom Web, featuring<input type="file">, File System Access API (showSaveFilePicker) with<a download>Blobfallback,DataTransfer+webkitGetAsEntryrecursive directory drops, and 256 KBBlob.slicestreaming.
1:1 Drop-in Compatibility Barrels #
package:file_drop/file_drop.dart: Unified API exporting all selector dialogs, cross-platform file/directory models, and drag-and-drop widgets.package:file_drop/file_selector.dart: Drop-in replacement barrel forfile_selector(1.1.x) andcross_file(0.3.x&0.4.x), exportingXFile,XDirectory,XEntity,FileSystemXFile,FileSystemXDirectory,XTypeGroup, andFileSaveLocation.package:file_drop/desktop_drop.dart: Drop-in replacement barrel fordesktop_dropacross both0.8.xand0.9.2, exportingDropTarget,DesktopDrop,DropItem,DropItemFile,DropItemDirectory,DropFileItem,DropDirectoryItem,DropStringItem,DropDoneDetails,DropEventDetails,DragDetails,DropDetails,DropOffer,DropItemPreview,DropItemKind, andDropOperation.
Cross-Platform File & Directory Dialogs #
- File open dialogs:
openFileandopenFilesacross all 6 platforms withacceptedTypeGroups(XTypeGroupextensions, MIME types,webWildCards, and Apple UTIs /uniformTypeIdentifiers),initialDirectory, andconfirmButtonText. - Cross-platform byte saving & desktop save locations:
saveFile(Uint8List bytes) across all 6 platforms, plus desktopgetSaveLocationreturningFileSaveLocation(pathandactiveFilter) and legacygetSavePath. - Directory pickers & temporary cache management:
openDirectoryreturningXDirectory(list(),exists()),getDirectoryPath,getDirectoryPaths, andclearTemporaryFilesfor cleaning up Android/iOS picker cache files and revoking tracked Webblob:URLs.
Cross-Platform Drag-and-Drop (DropTarget & DesktopDrop) #
- Multi-zone
DropTargetwidget supporting sibling, nested, andStack-overlapping drop zones viaRenderBoxbounds and paint-order hit-testing (HitTestBehavior). - Supports both
desktop_drop 0.8.xlifecycle callbacks (onDragEntered,onDragUpdated,onDragExited,onDragDone) anddesktop_drop 0.9.2callbacks and predicates (onEnter,onMove,onLeave,onDrop,acceptedKinds,onWillAccept,operation) with ancestor fallback when an inner target declines an offer. - Normalizes native pointer positions into Flutter global and widget-local logical coordinates across all 6 platforms (
View.getLocationInWindow+displayMetrics.densityon Android,UIWindowpoints on iOS, logical GDK widget coordinates on Linux,isFlipped = trueon macOS,ScreenToClient+ DPI scaling on Windows, andclientX/clientYon Web). - Manages asynchronous drop session lifetimes (
releaseDropSession) so AndroidDragAndDropPermissionsand iOS security-scoped resources remain valid throughoutasynconDragDone/onDrophandlers, alongside Android SAFrequestDirectoryAccessand Apple security-scoped bookmarks (appleBookmark/extraAppleBookmarkwithDesktopDrop.instance.startAccessingSecurityScopedResourceandstopAccessingSecurityScopedResource).