PPath class
路径工具类 提供一些常用的路径操作方法
Constructors
- PPath()
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
-
appCacheDir(
) → Future< Directory> - 获取应用缓存目录
-
appDocumentDir(
) → Future< Directory> - 获取应用文档目录 使用示例 void example() { PPath.appDocumentDir(); }
-
appDownloadDir(
) → Future< Directory?> - 获取下载目录(Android不支持)
-
appSupportDir(
) → Future< Directory> - 获取应用支持目录 使用示例 void example() { PPath.appSupportDir(); }
-
appTempDir(
) → Future< Directory> - 获取临时目录 使用示例 void example() { PPath.appTempDir(); }
-
buildFilePathInCache(
String fileName) → Future< String> - 构建Caches文件路径 使用示例 void example() { PPath.buildFilePathInCache('file.txt'); } 返回:/var/mobile/***/Library/Caches/file.txt
-
buildFilePathInDoc(
String fileName) → Future< String> - 构建Documents文件路径 使用示例 void example() { PPath.buildFilePathInDoc('file.txt'); } 返回:/var/mobile/***/Documents/file.txt
-
clearTempDir(
) → Future< void> -
createDir(
String path) → Future< Directory> - 根据路径创建一个目录 使用示例 void example() { PPath.createDir('documents/dir1/dir2'); } 返回:documents/dir1/dir2
-
createDirInCache(
String dirName) → Future< Directory> - 在应用缓存中添加一个目录 使用示例 void example() { PPath.createDirInCache('dir2'); } 返回:/var/mobile/***/Library/Caches/dir2
-
createDirInDoc(
String dirName) → Future< Directory> - 在应用文档中添加一个目录 使用示例 void example() { PPath.createDirInDoc('dir2'); } 返回:/var/mobile/***/Documents/dir2
-
createDirInTemp(
String dirName) → Future< Directory> - 在应用临时中添加一个目录 使用示例 void example() { PPath.createDirInTemp('dir2'); } 返回:/var/mobile/***/tmp/dir2
-
dirname(
String path) → String - 获取路径全路径目录 使用示例 void example() { PPath.dirname('documents/dir1/file.txt'); } 返回:documents/dir1
-
extension(
String path) → String - 获取路径的文件名扩展名 .ext 使用示例 void example() { PPath.extension('documents/dir1/file.txt'); } 返回:.txt
-
extStorageCacheDirs(
) → Future< List< Directory> ?> - 获取外部存储缓存目录(仅支持Android)
-
extStorageDir(
) → Future< Directory?> - 获取外部存储目录(仅支持Android)
-
filename(
String path) → String - 获取路径的文件名 使用示例 void example() { PPath.filename('documents/dir1/file.txt'); } 返回:file.txt
-
filenameWithoutExt(
String path) → String - 获取路径的文件名不包含后缀名 使用示例 void example() { PPath.filenameWithoutExt('documents/dir1/file.txt'); } 返回:file
-
join(
String path, String name) → String - 在一个目录下追加一个目录或文件名 使用示例 void example() { PPath.join('documents', 'dir1', 'file.txt'); } 返回:documents/dir1/file.txt