From 1e7ffde1279044c32b2a04520893215a6c35ffe6 Mon Sep 17 00:00:00 2001 From: agra Date: Wed, 13 May 2026 14:08:33 +0300 Subject: [PATCH] =?UTF-8?q?rename=20UxFile=20facade=20=E2=86=92=20UxFiles;?= =?UTF-8?q?=20add=20UxFile=20value=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Frees the UxFile name for the value type. UxFile is now a minimal {path} handle returned from anything in package:ux that produces a file on disk (camera capture today, future writers). The existing static-method namespace (pick/share/open/withScopedAccess/showInFolder/ videoThumbnail/supportsShowInFolder) becomes UxFiles. UxPickedFile is unchanged. Pairs with the banlu commit renaming the 5 app-side callers. --- lib/src/file.dart | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/src/file.dart b/lib/src/file.dart index 2d7f73d..f8d2c73 100644 --- a/lib/src/file.dart +++ b/lib/src/file.dart @@ -20,13 +20,25 @@ class UxVideoThumbnail { final int height; } +/// A handle to a file on local disk. Minimal — [path] is the only +/// guaranteed field. Returned from anything in `package:ux` that produces +/// a file (camera capture today; future writers). +class UxFile { + const UxFile(this.path); + + /// Absolute path on local disk. Readable through `dart:io File`. Lifetime + /// is producer-defined — camera capture writes to a temp dir, the + /// picker grant is held by the OS while the session is alive, etc. + final String path; +} + /// A file the user picked. [path] is on local disk and readable by /// `dart:io File` while the picker session's grant is active. /// /// On macOS / iOS the picker returns the user's original location (no /// temp-dir copy); access across cold restarts is preserved by storing -/// [bookmark] and re-acquiring scope via [UxFile.withScopedAccess] / -/// [UxFile.open] / [UxFile.showInFolder]. On Android the native side +/// [bookmark] and re-acquiring scope via [UxFiles.withScopedAccess] / +/// [UxFiles.open] / [UxFiles.showInFolder]. On Android the native side /// stream-copies a `content://` source into the app cache (since /// `dart:io` can't open content URIs); [bookmark] holds the source URI /// as UTF-8 bytes for symmetry but isn't required for reads. @@ -50,8 +62,8 @@ class UxPickedFile { final Uint8List? bookmark; } -class UxFile { - UxFile._(); +class UxFiles { + UxFiles._(); static const _channel = MethodChannel('ux/file');