在Flutter Web中读取和写入文件 [英] To read and Write File in Flutter Web

查看:89
本文介绍了在Flutter Web中读取和写入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在flutter-web上工作,我想在flutter-web中进行文件操作(读取和写入).对于Android和IOS,我使用的是path_provider依赖项.但是在flutter-web中不支持.

I am working on flutter-web, I would like to do file operations(read and write) in flutter-web. For Android and IOS, I was using path_provider dependency. But in flutter-web it is not supported.

任何人都可以帮我这个忙.一个例子会更有帮助.

Can anyone help me with this. An example would be more helpful.

谢谢

推荐答案

在dart文档中已得到解释... dart:io无法用于Web构建...这意味着您无法直接访问系统颤抖的网络中的文件.构建将会失败..您需要删除代码才能运行它

in the dart docs it has been explained ... dart:io is not available to web build ... it means that you can not directly access to system files in flutter web . the build will fail .. you need to remove the code in order to run it

这是安全的事情.. js也不允许它..想象一个网站,如果您访问它就可以读取您的所有系统文件..这就是为什么不允许诸如路径读取或文件读取之类的原因..颤抖也一样

this is a security thing .. js doesn't allow it too .. imagine a website that can read all your system files if you visit it .. that's why things like path reading or file reading is not allowed .. it goes same for flutter

希望您有答案

这篇关于在Flutter Web中读取和写入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆