您可以针对您提到的用例尝试此包:open_file
用法:
import 'package:open_file/open_file.dart';
import 'package:path_provider/path_provider.dart';
//Get the path to the directory
final String dir = (await getTemporaryDirectory()).path;
//Use the path to launch the directory with the native file explorer
await OpenFile.open('$dir\\');
Run Code Online (Sandbox Code Playgroud)
(注:仅在 Windows 操作系统上测试)
如果您想在 Android 上进行测试,请使用另一个目录,getExternalStorageDirectory因为getTemporaryDirectory在您的应用程序沙箱之外无法访问。
| 归档时间: |
|
| 查看次数: |
579 次 |
| 最近记录: |