如何在Flutter中添加文件选择器插件? [英] How to add a File Picker plugin in Flutter?

查看:1368
本文介绍了如何在Flutter中添加文件选择器插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个Flutter项目,在其中我要导入一个数据(JSON),并将其导出到用户想要的位置.为了实现这一点,我在Flutter中需要一个File Picker插件.现在,我在Dart Packages存储库中搜索了"file picker",但是没有找到.

I am creating a Flutter project in which, I have a piece of data (JSON) that I want to Import from and Export to a location the user wants to. In order to achieve this, I require a File Picker plugin in Flutter. Now, I searched the Dart Packages repository for "file picker" but didn't find one.

有没有办法获得如下所示的文件选择器:

Is there a way to get a File Picker that looks like this:

甚至是这个...

第一个屏幕截图对我来说比较理想,因为它允许从不同来源(例如云端硬盘)中选择文件.

The first screenshot is preferable for me as it allows file selection from different sources (like Drive).

此外,由于我要导出数据,因此可能也需要Folder Picker. ;)
但是,是否还有文件夹选择器"以外的其他选择.我很高兴知道...

Also, since I want to Export the data, I might want a Folder Picker too. ;)
But, if there is any other alternative to Folder Picker. I'd be happy to know...

推荐答案

我前段时间创建了一个file_picker插件,以便可以(在iOS和Android上)选择绝对路径,然后将其加载与Flutter.

I've created a file_picker plugin some time ago in order to make it possible to pick (both on iOS and Android) absolute paths and then loaded it with Flutter.

您可以在此处进行检查: https://pub.dartlang.org/packages/file_picker

You can check it here: https://pub.dartlang.org/packages/file_picker

这篇关于如何在Flutter中添加文件选择器插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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