FileUtils class
Constructors
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
-
clearCacheDir(
) → Future< void> - 清空缓存文件夹
-
createAppDocDir(
String? dirName) → Future< Directory?> -
在iOS Document文件加下,Android的Data的文件夹下创建文件夹
在iOS上,它使用“NSDocumentDirectory”API。如果数据不是用户生成的,请考虑使用
GetApplicationSupportDirectory
。 在Android上,这在上下文中使用了“getDataDirectory”API -
createDir(
String? path) → Directory? - 同步创建文件夹
-
createDirSync(
String? path) → Future< Directory?> - 异步创建文件夹
-
createFile(
String? filePath) → Future< bool> - 创建文件
-
createStorageDir(
String? dirName) → Future< Directory?> - 在Android getExternalStorageDirectory 的路径下创建文件夹 dirName 文件夹名 支持Android 不支持iOS
-
createSupportDir(
String? dirName) → Future< Directory?> - 在iOS NSApplicationSupportDirectory 的路径下创建文件夹 dirName 文件夹名 支持iOS 不支持Android
-
createTempDir(
String? dirName) → Future< Directory?> - 在临时目录下创建文件夹 在iOS上,它使用“NSCachesDirectory”API。 在Android上,它在上下文中使用“getCacheDir”API。
-
deleteDir(
FileSystemEntity file) → Future< void> - 删除某个文件夹
-
deleteFile(
String? filePath) → Future< bool> - 删除文件
-
formatSize(
double value) → String - 将文件大小格式化为 'B', 'K', 'M', 'G'
-
getAppDocDir(
) → Future< String?> - 获取应用程序的目录,用于存储只有它可以访问的文件。只有当应用程序被删除时,系统才会清除目录。
-
getAppDocPath(
{String? fileName, String? dirName}) → Future< String> - 获取应用程序的目录,用于存储只有它可以访问的文件。只有当应用程序被删除时,系统才会清除目录。 fileName 文件名 dirName 文件夹名
-
getStoragePath(
{String? fileName, String? dirName}) → Future< String> - 应用程序可以访问顶层存储的目录的路径 支持Android 不支持iOS fileName 文件名 dirName 文件夹名
-
getTempDir(
) → Future< String?> - 获取一个临时目录(缓存),系统可以随时清除。
-
getTempPath(
{String? fileName, String? dirName}) → Future< String> - 获取设备上临时目录的路径,该目录没有备份,适合存储下载文件的缓存。 fileName 文件名 dirName 文件夹名
-
getTotalSizeOfFilesInDir(
FileSystemEntity file) → Future< double> - 获取指定文件夹下文件的大小
-
loadCacheDirSize(
) → Future< double> - 获取Cache文件下文件大小 getTemporaryDirectory 获取应用缓存目录, 等同IOS的NSCachesDirectory和Android的getCacheDir方法
-
readStringDir(
String? filePath) → Future< String?> - 获取存在文件中的数据 使用async、await,返回是一个Future对象
-
writeJsonToFile(
Object? obj, String? filePath) → Future< File?> - 写入json文件