flutter path_provider 插件介绍
1、path_provider插件的官方讲解
https://pub.flutter-io.cn/packages/path_provider
2、path_provider插件的安装
首先,添加依赖,在pubspec.yaml文件下添加,如下所示:
dependencies:
path_provider: ^1.6.9
然后,在终端运行flutter packages get命令。
最后,导入:
import 'package:path_provider/path_provider.dart';
3、path_provider插件的用法
Directory tempDir = await getTemporaryDirectory();
String tempPath = tempDir.path;
Directory appDocDir = await getApplicationDocumentsDirectory();
String appDocPath = appDocDir.path;