28 lines
824 B
Dart
28 lines
824 B
Dart
// Author: fengshengxiong
|
|
// Date: 2024/5/10
|
|
// Description: 本地路径
|
|
|
|
import 'package:path_provider/path_provider.dart';
|
|
|
|
class LocalPathUtil {
|
|
/// 获取临时文件路径(IOS和Android通用)
|
|
/// Android: /data/user/0/包名/cache
|
|
static Future<String> getTemporaryPath() async {
|
|
final dir = await getTemporaryDirectory();
|
|
return dir.path;
|
|
}
|
|
|
|
/// 获取应用支持目录(IOS和Android通用)
|
|
/// Android: /data/user/0/包名/files
|
|
static Future<String> getSupportPath() async {
|
|
final dir = await getApplicationSupportDirectory();
|
|
return dir.path;
|
|
}
|
|
|
|
/// 获取应用文件目录(IOS和Android通用)
|
|
/// Android: /data/user/0/包名/app_flutter
|
|
static Future<String> getDocumentsPath() async {
|
|
final dir = await getApplicationDocumentsDirectory();
|
|
return dir.path;
|
|
}
|
|
} |