flutter_absolute_path
v1.0.6 依赖项不支持空安全吗?有没有其他方法可以获取文件的绝对路径?
for (int i = 0; i < resultList.length; i++) {
var path = await
FlutterAbsolutePath.getAbsolutePath(resultList[i].identifier);
print(path + '**path**');
f.add(File(path));
}
答案 0 :(得分:0)
试试这个插件 file_picker file_picker: ^3.0.3
//use this line to pick files
FilePickerResult? result = await FilePicker.platform.pickFiles();
//use this to process what file is returned
if(result != null) {
File file = File(result.files.single.path);
} else {
// User canceled the picker
}
您可以在此处阅读有关额外功能的信息: https://pub.dev/packages/file_picker