clear method
Evicts all entries from DiskCache.
Implementation
Future<bool> clear() async {
try {
Directory tempDir =
Directory(join((await getTemporaryDirectory()).path, 'imagecache'));
Directory appDir = Directory(
join((await getApplicationDocumentsDirectory()).path, 'imagecache'));
File metadataFile = File(join(
(await getApplicationDocumentsDirectory()).path, _metadataFilename));
if (tempDir.existsSync()) await tempDir.delete(recursive: true);
if (appDir.existsSync()) await appDir.delete(recursive: true);
if (metadataFile.existsSync()) await metadataFile.delete();
_metadata = {};
return true;
} catch (e) {
if (printError) print(e);
return false;
}
}