clearTemp method

Future<void> clearTemp()

Clear all temporary files

Implementation

Future<void> clearTemp() async {
  _ensureInitialized();
  final tempDir = Directory(path.join(_baseDirectory!.path, 'Temp'));
  if (await tempDir.exists()) {
    await for (final entity in tempDir.list()) {
      if (entity is File) {
        await entity.delete();
      } else if (entity is Directory) {
        await entity.delete(recursive: true);
      }
    }
    _logger.info('Temp directory cleared');
  }
}