clearCacheFor static method
Static method for Dynamic call
Returns bool
after deleting files from App's Package files
folder
for respective Granted Directory
To cache an Directory call cache
Implementation
static Future<bool?> clearCacheFor(String? directory) async {
if (directory == null) return null;
try {
const kClearCachedFiles = "clearCachedFiles";
const kCacheDirectoryName = "cacheDirectoryName";
var cacheDirectoryName = makeDirectoryPathToName(directory);
final args = <String, dynamic>{
kCacheDirectoryName: cacheDirectoryName,
};
final cleared = await kDocumentFileChannel.invokeMethod<bool?>(
kClearCachedFiles, args);
if (cleared == null) return null;
return cleared;
} catch (e) {
return null;
}
}