FileUtils class

Constructors

FileUtils()

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

clearFileData(String filePath) Future<bool>
清除缓存数据
clearFileDataDir(String fileName) Future<bool>
清除缓存数据
deleteFileData(String filePath) Future<bool>
删除缓存文件
deleteFileDataDir(String fileName) Future<bool>
删除缓存文件
getAppDocDir() Future<String?>
文档目录: /data/user/0/com.yc.utils/xxx 获取应用程序的目录,用于存储只有它可以访问的文件。只有当应用程序被删除时,系统才会清除目录。
getAppFile(String fileName) Future<File?>
初始化文件路径,默认选中应用程序的目录
getTempDir() Future<String?>
临时目录: /data/user/0/com.yc.utils/cache 获取一个临时目录(缓存),系统可以随时清除。
readFile(dynamic filePath) File
下面这些方法需要传递自定义存储路径----------------------------------------------- 创建file文件
readStringCustomFile(String filePath) Future<String?>
获取自定义路径文件存中的数据 使用async、await,返回是一个Future对象
readStringDir(String fileName) Future<String?>
获取存在文件中的数据,默认读到应用程序的目录 使用async、await,返回是一个Future对象
writeJsonCustomFile(Object? obj, String filePath) Future<File?>
写入json文件,自定义路径
writeJsonFileDir(Object? obj, String fileName) Future<File?>
写入json文件,默认写到应用程序的目录
writeStringDir(String? string, String filePath) Future<File?>
利用文件存储字符串,默认写到应用程序的目录
writeStringFile(String? string, String filePath) Future<File?>
利用文件存储字符串,自定义路径

Constants

TAG → const String