CkPath class abstract

A utility class for accessing standard device directories and file paths.

Easily retrieve temporary, documents, cache, downloads, and support directories:

// Get Directory instances
final tempDir = await CkPath.getTemporaryDirectory();
final docDir = await CkPath.getApplicationDocumentsDirectory();

// Get String paths directly
final tempPath = await CkPath.tempPath;
final docsPath = await CkPath.documentsPath;

// Create a temporary file (ideal for audio recording, camera captures, caching)
final voiceFile = await CkPath.createTempFile(
  prefix: 'rec_',
  extension: 'm4a',
);

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 Properties

cacheDir Future<Directory>
Alias for getApplicationCacheDirectory.
no setter
cacheDirectory Future<Directory>
Alias for getApplicationCacheDirectory.
no setter
cachePath Future<String>
Returns the absolute path string of the application cache directory.
no setter
docsDir Future<Directory>
Alias for getApplicationDocumentsDirectory.
no setter
docsPath Future<String>
Alias for documentsPath.
no setter
documentsDir Future<Directory>
Alias for getApplicationDocumentsDirectory.
no setter
documentsDirectory Future<Directory>
Alias for getApplicationDocumentsDirectory.
no setter
documentsPath Future<String>
Returns the absolute path string of the application documents directory.
no setter
downloadsDir Future<Directory?>
Alias for getDownloadsDirectory.
no setter
downloadsDirectory Future<Directory?>
Alias for getDownloadsDirectory.
no setter
downloadsPath Future<String?>
Returns the absolute path string of the downloads directory, or null if not available.
no setter
externalStorageDir Future<Directory?>
Alias for getExternalStorageDirectory.
no setter
externalStoragePath Future<String?>
Returns the absolute path string of external storage, or null if not available.
no setter
supportDir Future<Directory>
Alias for getApplicationSupportDirectory.
no setter
supportDirectory Future<Directory>
Alias for getApplicationSupportDirectory.
no setter
supportPath Future<String>
Returns the absolute path string of the application support directory.
no setter
tempDir Future<Directory>
Alias for getTemporaryDirectory.
no setter
temporaryDirectory Future<Directory>
Alias for getTemporaryDirectory.
no setter
tempPath Future<String>
Returns the absolute path string of the temporary directory.
no setter

Static Methods

clearTemp() Future<void>
Deletes all files within the temporary directory without deleting the directory itself.
createDocumentFile(String fileName) Future<File>
Creates and returns a File inside the application documents directory.
createTempFile({String? fileName, String? prefix, String? extension}) Future<File>
Creates and returns a File inside the temporary directory.
getApplicationCacheDirectory() Future<Directory>
Path to the directory where application specific cache files can be stored.
getApplicationDocumentsDirectory() Future<Directory>
Path to a directory where the application may place data that is user-generated, or that cannot otherwise be recreated by your application.
getApplicationSupportDirectory() Future<Directory>
Path to a directory where the application may place application support files.
getCacheFilePath(String fileName) Future<String>
Generates a full file path inside the application cache directory.
getDocumentFilePath(String fileName) Future<String>
Generates a full file path inside the application documents directory.
getDownloadsDirectory() Future<Directory?>
Path to the directory where downloaded files are stored. Supported on Android, iOS, macOS, Windows, Linux.
getExternalCacheDirectories() Future<List<Directory>?>
Paths to directories where application specific external cache data can be stored (Android only).
getExternalStorageDirectories({StorageDirectory? type}) Future<List<Directory>?>
Paths to directories where application specific data can be stored (Android only).
getExternalStorageDirectory() Future<Directory?>
Path to the primary external storage directory (Android only).
getTempFilePath({String? fileName, String? prefix, String? extension}) Future<String>
Generates a full file path inside the temporary directory.
getTemporaryDirectory() Future<Directory>
Path to the directory where any newly created files may be allocated to the system temporary folder.
join(String part1, String part2, [String? part3, String? part4, String? part5]) String
Joins path parts using the appropriate platform separator.