CacheManager class
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
Static Methods
-
clearApplicationCache({dynamic docDirectory, dynamic tempDirectory})
→ void
-
删除缓存
注意: Web 平台不支持文件系统操作
-
formatSize(double? value)
→ String
-
-
getCache({dynamic docDirectory, dynamic tempDirectory})
→ Future<String>
-
-
loadApplicationCache({dynamic docDirectory, dynamic tempDirectory})
→ Future<double>
-
外部可借助 path_provider 获取指定的目录读取大小
Directory docDirectory = await getApplicationDocumentsDirectory();
Directory tempDirectory = await getTemporaryDirectory();
注意: Web 平台不支持文件系统操作,将返回 0
-
writeToFile(dynamic documentsDir, String fileName, String notes, {String? direcName, String? userId = "user"})
→ Future
-
将数据内容写入doc文件夹里,如果不传direcName,默认存doc文件夹
documentsDir 文件夹 ---路径。没有则创建
fileName: 文件名
notes 要存储的内容
direcName 文件夹名字,如分类,首页,购物车,我的等。可不传
userId 可根据不同的用创建不同的文件夹 简单标示
注意: Web 平台不支持文件系统操作,将抛出 UnsupportedError