XDropFile class

A file delivered by an OS drag-and-drop.

path is readable through dart:io File while the drag grant is alive. bookmark is a macOS security-scoped bookmark with the same shape as XPickedFile.bookmark, so a sandboxed read can re-acquire access via XFiles.withScopedAccess. name is the basename. mimeType is always null on macOS and Windows — classify by extension.

Constructors

XDropFile({required String path, required String name, String? mimeType, Uint8List? bookmark, bool isTemporaryCopy = false, bool isDirectory = false})
Creates a descriptor for one dropped file.
const

Properties

bookmark → Uint8List?
macOS security-scoped bookmark for a sandboxed read, or null.
final
hashCode → int
The hash code for this object.
no setterinherited
isDirectory → bool
True when path is a directory — a folder, or a macOS package the Finder presents as a single file (.utm, .app, …). A directory can't be uploaded as one file, so the app zips it before sending rather than enqueuing a send that would fail (stat'ing the path throws Is a directory).
final
isTemporaryCopy → bool
True when path is an app-owned temp copy the OS wrote for a promised file — a drag from a source that vends NSFilePromiseReceiver outputs rather than a concrete file URL (e.g. Photos), or, on Windows, a virtual file offered only as CFSTR_FILECONTENTS (an Outlook attachment, an image from a browser) — rather than a durable user-chosen location. Callers should treat such a source as ephemeral: promote its bytes into a managed cache after upload instead of recording the temp path in place (it is purged with the OS temp dir). False for plain file URLs. Mirrors XPickedFile.isTemporaryCopy.
final
mimeType → String?
MIME type if the platform supplied one; always null on macOS and Windows.
final
name → String
Basename of path.
final
path → String
Absolute path on local disk, readable while the drag grant is alive.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

fromItem(Map<Object?, Object?> item) → XDropFile?
Decodes one item from the native ux/drop/events drop payload. Returns null when the item carries no usable path (so a malformed item is skipped rather than yielding a phantom file). Exposed for testing the wire decode; the channel itself is exercised end-to-end on device.