StorageModule class

Lightweight storage access module.

Provides secure app-private file I/O, storage diagnostics, and cache management without heavy third-party dependencies.

Constructors

StorageModule()

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

appendFile(String fileName, String content) → Future<String?>
Appends text to a file in app-private storage.
clearCache() → Future<bool>
Clears the app cache directory to free space.
deleteFile(String fileName) → Future<bool>
Deletes a file from app-private storage.
deleteIfExists(String fileName) → Future<bool>
Deletes a file if present and returns true when no file remains.
fileExists(String fileName) → Future<bool>
Checks if a file exists in app-private storage.
getAppDirectory() → Future<String?>
Returns the app-private files directory path.
getCacheDirectory() → Future<String?>
Returns the app cache directory path.
getExternalDirectory() → Future<String?>
Returns the external storage directory path (null if unavailable).
getStorageInfo() → Future<StorageInfo?>
Returns device storage metrics (total, free, cache size, etc.).
listFiles() → Future<List<FileInfo>>
Lists all files and directories in app-private storage.
migrateStorage(int fromVersion, int toVersion, Future<void> migrator(int version)) → Future<void>
Safely migrates app data across version updates.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readBytes(String fileName) → Future<Uint8List?>
Reads raw bytes from a file. Returns null if not found.
readFile(String fileName) → Future<String?>
Reads a text file from app-private storage. Returns null if the file does not exist.
readJson<T extends Object>(String fileName) → Future<T?>
Reads a JSON value from app-private storage.
toString() → String
A string representation of this object.
inherited
writeBytes(String fileName, Uint8List bytes) → Future<String?>
Writes raw bytes to a file in app-private storage.
writeFile(String fileName, String content) → Future<String?>
Writes a text file to app-private storage. Returns the absolute path of the written file.
writeJson(String fileName, Object? value) → Future<String?>
Writes a JSON-serializable value to app-private storage.

Operators

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