purgeOldLogs method
Deletes all logs older than 2 days from persistent storage.
The logs are deleted asynchronously in a separate isolate to avoid blocking the main isolate.
This is useful for limiting the amount of disk space used by the log files.
Implementation
Future<void> purgeOldLogs() async {
final dir = await getApplicationSupportDirectory();
final path = dir.path;
await Isolate.run(
() => SimpleOverlayIsolateLogWriter.purgeOldLogs(path, 2));
}