cleanLog method
void
cleanLog()
Implementation
void cleanLog() async {
// final dir = await getLocalSupportDir();
final String? dir;
if (Platform.isWindows) {
dir = await getLocalSupportDir();
} else if (Platform.isAndroid) {
final esdTemp = await getExternalStorageDirectory();
if (esdTemp != null) {
dir = esdTemp.path;
} else {
final tdTemp = await getTemporaryDirectory();
dir = tdTemp.path;
}
} else {
dir = await getLocalDocumentDir();
}
if (dir == null) {
return;
}
Directory(dir).list(followLinks: false).forEach((file) {
if (path.extension(file.path) == ".log" || path.extension(file.path) == ".dmp") {
file.delete();
}
});
}