saveCacheLog function
Save cache to /cache folder in root of this project
Implementation
void saveCacheLog(String html, bool debug) {
if (!debug) return;
try {
int timestamp = DateTime.now().millisecondsSinceEpoch;
String rootPath = findRootDirectory(Directory.current.path);
File cache = File('$rootPath/cache/cache.html');
String cacheHtml = cache.readAsStringSync();
File file = File('$rootPath/cache/$timestamp.html');
file.writeAsStringSync(cacheHtml);
cache.writeAsStringSync(html, mode: FileMode.write);
} catch (e) {
printLog(
'Unable to save file to /cache folder',
debug,
color: LogColor.red,
);
}
}