feat: Android get storage permission via SAF

This commit is contained in:
13574
2023-09-09 01:18:59 +08:00
parent b23d1a193f
commit d0e5178dc8
7 changed files with 220 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ final Logger _log = Logger("platformPath");
class Path {
static const platform = MethodChannel("lifegpc.eh_downloader_flutter/path");
static const _safChannel=MethodChannel("lifegpc.eh_downloader_flutter/saf");
String? _currentExe;
bool _currentExeLoaded = false;
@@ -25,4 +26,9 @@ class Path {
_currentExeLoaded = true;
return _currentExe;
}
/// 保存文件
static Future<void> saveFile(String filenameWithoutExtension,String mimeType,Uint8List bytes,{String dir=""}) async{
return _safChannel.invokeMethod("saveFile",[filenameWithoutExtension,dir,mimeType,bytes]);
}
}