FileManager class

文件管理器,提供统一的本地文件目录管理能力,包括路径获取、创建、清理和删除等操作。

A file manager that provides unified local directory management capabilities, including path retrieval, creation, clearing, and deletion.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

downloadPath → String?
获取下载文件夹路径
no setter
logsPath → String?
获取日志文件夹路径
no setter
preloadPath → String?
获取预加载文件夹路径
no setter
snapshotPath → String?
获取截图文件夹路径
no setter

Static Methods

clearCache() → FileResult<Map<FolderType, bool>>
清理缓存文件(目前仅清理预加载文件夹)
clearFolder(FolderType type, [StorageType? storageType]) → FileResult<void>
清空指定类型的文件夹内容(不删除文件夹本身)
deleteFolder(FolderType type, [StorageType? storageType]) → FileResult<void>
删除指定类型的文件夹及其所有内容
ensureFolder(FolderType type, [StorageType? storageType]) → FileResult<String>
确保指定类型的文件夹存在,若不存在则尝试创建
getDownloadFilePath(String fileName) → String?
获取下载文件的完整路径
getFilePath(FolderType type, String fileName, [StorageType? storageType]) → String?
根据文件夹类型和文件名获取完整文件路径
getFolderPath(FolderType type, [StorageType? storageType]) → String?
获取指定类型的文件夹路径(带缓存)
getLogFilePath(String fileName) → String?
获取日志文件的完整路径
getPreloadFilePath(String fileName) → String?
获取预加载文件的完整路径
getSnapshotFilePath(String fileName) → String?
获取截图文件的完整路径
initializeAllFolders([StorageType? storageType]) → FileResult<Map<FolderType, String>>
初始化所有预定义类型的文件夹
resetForTesting() → void
Reset all static state for testing.