delete method

Future<void> delete(
  1. File file, {
  2. bool recursive = false,
})

Deletes file under the current concurrency limit.

Useful when removing many files at once to avoid overwhelming the file system. Wraps File.delete.

Implementation

Future<void> delete(File file, {bool recursive = false}) async {
  await _semaphore.acquire();
  try {
    await file.delete(recursive: recursive);
  } finally {
    _semaphore.release();
  }
}