file_system_access 0.2.2
file_system_access: ^0.2.2 copied to clipboard
Real files on Flutter Web. Save in place instead of downloading a copy, and reopen the same file after a reload with the File System Access API.
0.2.2 #
Declared web-only on pub.dev. The listing claimed all six platforms. That
was inferred from the package compiling on all six — which it does on purpose,
so that an app also targeting mobile can depend on it without conditional
imports — and the inference reads compiling as supporting. It is not: the File
System Access API is a browser API, and off the web isSupported is false and
every call throws UnsupportedByBrowserException. Five of the six platforms on
that listing were places this package does nothing at all.
A platforms: web: key states the one that is true. It is metadata, not a
build constraint, so the compiles-everywhere property and the "Off the web"
section it supports are both unchanged.
No code changes.
0.2.1 #
No code changes. This release exists because the package was almost impossible to install.
sdk: ^3.13.0 meant Dart 3.13, which only ships with Flutter 3.47 —
released three weeks ago. Anyone on an older SDK hit a version-solve failure
before they could try it. The floor is now ^3.5.0 / Flutter 3.24, and it is
tested: the library resolves and type-checks against Flutter 3.16.9 / Dart
3.2.6, so the declared range is narrower than the verified one.
0.2.0 #
An audit of every package in this repo found five defects here, one of them in the first snippet of the README.
Fixed #
- A failed read threw something you could not catch.
readBytes,readTextand the directory paths translated nothing, so a browser rejection crossed into Dart as a rawDOMException— invisible toon FileSystemAccessException, which is the error contract this package exists to provide. Every browser rejection now goes through one translator. - The README's flagship snippet printed null. It recalled
'last-document'without ever remembering it. Theremembercall is there now. - A failing close replaced the real write error.
await stream.close()sat in afinally, so when a write failed the close failed too and its bareTypeErrorwas what surfaced — the caller never learned the disk was full or the permission had lapsed. Whichever failure came first is kept. - Recalling the wrong kind returned a wrong-typed handle. File and
directory handles are extension types over the same JS object, so the cast
always succeeded and only broke later somewhere unrelated. Both now check
kindand return null on a mismatch. - An aborted IndexedDB transaction hung forever.
_donelistened for complete and error but not abort, so a quota failure or a tab closing mid-write leftrememberandforgetawaiting a future nobody would complete.
0.1.1 #
PermissionDeniedExceptionis now actually thrown. It was exported from 0.1.0 but nothing raised it, so a caller could write acatchthat could never fire. A refused write surfaces as the browser'sNotAllowedError, which says nothing useful on its own; it is now translated, and the message says to callrequestPermission(write: true)from a user gesture.
0.1.0 #
Initial release: the File System Access API for Flutter Web.
openFiles,saveFileandopenDirectorywrap the three pickers, whichpackage:webmentions in its doc comments but does not bind.FileHandle.writeText/writeByteswrite back into the file the user picked, in place — not a second copy in their Downloads folder.remember/recallFile/recallDirectorykeep a handle in IndexedDB, so the same file is reachable after a full page reload.DirectoryHandlelists, opens and removes entries, with async iteration bound by hand sincepackage:webdoes not expose it.permissionandrequestPermissionreportgranted,promptordeniedrather than a boolean, because "must ask" is not the same as "refused".FileSystemAccess.supportanswers for each picker and the origin-private file system separately — Safari has the latter and none of the former.- Off the web the package still compiles and reports everything unsupported.
Tested in a real browser via flutter test --platform chrome, including a
handle stored in IndexedDB and the file read back through it after recall.