如何从Flutter Web引用本地文件?

发布于 2025-02-13 15:27:46 字数 256 浏览 2 评论 0原文

这个想法是以下内容:我需要用户能够从其本地文件系统中挑选图像,并以某种方式在用户下次使用该应用程序时使图像可用。浏览器本地存储只为您提供了如此之多的空间,因此想法是仅保存其地址并在需要时检索图像。如果有人有更好的解决方案,这将不胜感激,据我了解,移动/删除图像将导致它无法检索。

注意我想在不需要后端的情况下完成此

这甚至可能吗?我知道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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧瑾黎汐 2025-02-20 15:27:46

这个问题比Web平台本身更具特殊性。

Web上的推荐解决方案是将其存储在indexedDB中:使用indexeddb来保存图像

indexeddb 由DART本地支持:html https://api.dart.dev/stable/2.17.3/dart-indexed_db/dart-indexed_db-library.html

This 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文