开发者

Flutter Exclude file path not working while getting files

开发者 https://www.devze.com 2022-12-07 19:38 出处:网络
i am getting all pdf from device storage and working fine but in Android 12 permission denied errno 13 and asking to exclude Android/data folder im trying but the exclude is not working

i am getting all pdf from device storage and working fine but in Android 12 permission denied errno 13 and asking to exclude Android/data folder im trying but the exclude is not working code to get files and exclude path

void getFiles() async {
if (await Permission.storage.request().isGranted) {
  // Either the permission was already granted before or the user just granted it.
}
//asyn function to get list of files
List<StorageInfo> storageInfo = await PathProviderEx.getStorageInfo();
var root = storageInfo[0]
    .rootDir; //storageInfo[1] for SD card, geting the root directory
var fm = FileManager(root: Directory(root)); //
files = await fm.filesTree(
    excludedPaths: ["/storage/emulated/0/Android/data"],
    extensions: ["开发者_运维技巧pdf"] //optional, to filter files, list only pdf files
);
setState(() {}); //update the UI

}

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号