gpt4 book ai didi

android - 操作系统错误 : No such file or directory, 错误编号 = 2 -- flutter

转载 作者:IT王子 更新时间:2023-10-29 07:09:36 26 4
gpt4 key购买 nike

在我的 flutter 项目中,我想获取名为“.../myApp/services”的目录中所有文件的列表。

Widget getServices(){
Directory dir = Directory("services");
print(dir.absolute);
dir.list().listen(
(FileSystemEntity file) {
services.add(FileImage(file));
}
);

但是使用这段代码,调试控制台的输出是这样的:

enter image description here

它打印绝对路径,然后给出这个错误。我不明白...路径是否有效?

最佳答案

你必须在 pubspec.yaml 中注册你的目录

enter image description here

第 2 步

-使用this plugin扫描 pubspecs.yaml 以获取您的 Assets

关于android - 操作系统错误 : No such file or directory, 错误编号 = 2 -- flutter ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54696667/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com