FileUtil class

文件工具类

File utility 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

Operators

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

Static Methods

clearDirectory(String path) → FileResult<void>
清空目录内容
copyFile(String sourcePath, String targetPath) → FileResult<File>
复制文件
createDirectory(String path) → FileResult<Directory>
创建目录(若不存在)
createFile(String path, {String? content}) → FileResult<File>
创建文件
deleteDirectory(String path, {bool recursive = false}) → FileResult<void>
删除目录
deleteFile(String path) → FileResult<void>
删除文件
exists(String path) → bool
检查文件或目录是否存在
getDirectorySize(String path) → FileResult<int>
获取目录大小
getFileSize(String path) → FileResult<int>
获取文件大小
listDirectory(String path, {bool recursive = false}) → FileResult<List<FileSystemEntity>>
列出目录内容
moveFile(String sourcePath, String targetPath) → FileResult<File>
移动文件
readFile(String path) → FileResult<String>
读取文件内容
writeFile(String path, String content) → FileResult<File>
写入文件内容