StorageUtils class

存储文件管理类

Constructors

StorageUtils()

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 Methods

createAppDocDir({required String dirName}) Future<Directory?>
创建获取应用程序的目录 fileName 文件名 dirName 文件夹名 String path = StorageUtil.getAppDocPath(fileName: 'demo.mp4', dirName: 'video');
createDir(String path) Directory?
同步创建文件
createDirSync(String path) Future<Directory?>
异步创建文件
createStorageDir({required String dirName}) Future<Directory?>
dirName 文件夹名 category 分类,例如:video,image等等 String path = StorageUtil.getStoragePath(fileName: 'yc.apk', dirName: 'apk');
createTempDir({required String dirName}) Future<Directory?>
创建临时目录 dirName 文件夹名 String path = StorageUtil.createTempDir( dirName: 'image');
getAppDocPath({required String fileName, required String dirName}) Future<String?>
获取应用程序的目录,用于存储只有它可以访问的文件。只有当应用程序被删除时,系统才会清除目录。 fileName 文件名 dirName 文件夹名 String path = StorageUtil.getAppDocPath(fileName: 'demo.mp4', dirName: 'video');
getStoragePath({required String fileName, required String dirName}) Future<String?>
fileName 文件名 dirName 文件夹名
getTempPath({required String fileName, required String dirName}) Future<String?>
获取设备上临时目录的路径,该目录没有备份,适合存储下载文件的缓存。 fileName 文件名 dirName 文件夹名 String path = StorageUtil.getTempPath(fileName: 'demo.png', dirName: 'image');