-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[path_provider] Add support for web #45296
Comments
Since its not possible to access the filessystem on the web... how should this be done? |
I can imagine that this might be useful in some contexts on the web. Like which folder to open a file-download picker to. (For user content). For cached content, I'm not sure it makes sense on the web. But it is pretty annoying to get a flood of errors in the console on web when trying to use a package like google_fonts which uses this plugin. |
I actually fixed it for the google_fonts package some days ago. Just update. But still a lot of packages use it like on mobile. |
Some work related to federation is happening here: |
I was trying to download a file on my Windows OS using path_provider. getDownloadsDirectory(), and faced issues related to platform, then found this existing issue link. Looks like I may not be able to do my task until this issue is resolved. Please add support for flutter web in this library. |
Patiently waiting |
I am using Flutter (Channel beta, 1.21.0-9.1.pre, on Mac OS X 10.15.6 19G73, locale en) with path-provider 1.6.14, the following works on Android and IOS but fails when run on web, it does not return a path. `import 'package:flutter/material.dart'; void main() async { |
@johnareid54 path_provider is not supported at all in web. Also, there's no standard concept "filesystem" or "path" on web browsers, so we'll first need to figure that out before we can implement a path_provider plugin. |
@ditman path_provider is not supported at all in web. |
@johnareid54 The default behavior for unimplemented plugins is to throw an How is |
I think the better way to do something is open a default modal like when you are downloading something, will popop up a modal for you save the download in any place. We can use the same concept. Instead pick the path it self just will open some modal for us, for picking ours self |
This comment has been minimized.
This comment has been minimized.
Web build is currently unsupported due to Path Provider’s File I/O interface web support. flutter/flutter#45296
This comment was marked as off-topic.
This comment was marked as off-topic.
I find web File System Access API belowd: Not sure can help. |
@yingming25 I've been following that API for a while, but as of now, it's not very well supported: This may be another way to go: https://developer.mozilla.org/en-US/docs/Web/API/FileSystem (But again, the above needs to be supported by dart or a plugin that collaborates with the path_provider, otherwise it won't make sense). |
This comment was marked as off-topic.
This comment was marked as off-topic.
I have a solution for Firebase storage, my issue was with PDF file, with this snippet you could download or preview PDF in browser. |
It seems that both Chrome and Webkit are implementing the "Origin Private File System": The API above seems to provide files + directories that are persisted in some form of "private storage" that the browser keeps hidden, like the sandboxed storages of mobile apps. It is unclear to me what's the quota, or what happens if a user "clears their local storage", if users are going to be able to "pick" a file from the private storage (or you'll need to write your own filepicker for this), or how to make this work with (Firefox seems to be working on it too.) |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as duplicate.
This comment was marked as duplicate.
It seems that from the link you shared, the FileSystem API implementation made excellent progress. |
The most promising API at the moment is OPFS: |
This comment was marked as off-topic.
This comment was marked as off-topic.
I was reading a file in my flutter web project and got this error:
I searched the web and found an answer that the browser can't read files. The solution has an Then I found https://docs.flutter.dev/cookbook/persistence/reading-writing-files which pointed me to this issue:
But all I really wanted was this line:
Which I found in this answer. I could open another issue complaining that the original error message is cryptic. But perhaps adding the information in this issue is enough? |
@ubershmekel It looks like that recipe points to this issue because the recipe uses |
Basic OPFS features are now supported by all major browsers. Isn't it enough to add support for at least the getApplicationDocumentsDirectory? |
There's a good explainer here: We may be able to improve some features of cross_file (like Save As...) using the API. Note that the OPFS is private and invisible to the user, so anything that needs to be downloaded to the public user FS needs to be "saved as". |
We should add web support for
path_provider
The text was updated successfully, but these errors were encountered: