getLocalDocumentFile method

Future<File?> getLocalDocumentFile({
  1. required String fileName,
  2. String? filePath,
})

获取文档目录文件,用于存储只能由该应用访问的文件,系统不会清除该目录,只有在删除应用时才会消失。

Implementation

Future<File?> getLocalDocumentFile({required String fileName, String? filePath}) async {
  try {

    final dir = await getApplicationDocumentsDirectory();
    return _getFile(dir, filePath, fileName);
  } catch (e) {
    logger.e(tag: TAG, e);
    return null;
  }
}