如何从Flutter Web引用本地文件?
这个想法是以下内容:我需要用户能够从其本地文件系统中挑选图像,并以某种方式在用户下次使用该应用程序时使图像可用。浏览器本地存储只为您提供了如此之多的空间,因此想法是仅保存其地址并在需要时检索图像。如果有人有更好的解决方案,这将不胜感激,据我了解,移动/删除图像将导致它无法检索。
注意我想在不需要后端的情况下完成此。
这甚至可能吗?我知道dart:io
在Web上不支持。
The idea is the following: I need users to be able to pick images from their local filesystems, and somehow make the images available the next time the user uses the app. Browser local storage only gives you so much space so the idea is to only save their address and retrieve the image when needed. If anyone has a better solution that would be greatly appreciated, as I understand that moving/deleting the image would result in it not being retrievable.
Note I want to accomplish this without needing a backend.
Is this even possible? I know dart:io
is not supported on web.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个问题比Web平台本身更具特殊性。
Web上的推荐解决方案是将其存储在indexedDB中:使用indexeddb来保存图像
indexeddb 由
DART本地支持:html
: https://api.dart.dev/stable/2.17.3/dart-indexed_db/dart-indexed_db-library.htmlThis question is more specific to web platform itself than Flutter.
Recommended solution on Web is to store it in IndexedDB: Using IndexedDB to save images
IndexedDB is supported natively by
dart:html
: https://api.dart.dev/stable/2.17.3/dart-indexed_db/dart-indexed_db-library.html