delete method

Future delete ()

Deletes the temp directory for this environment.

This class is no longer valid once the directory is deleted, you must create a new ScratchSpace.


Future delete() async {
  if (!exists) {
    throw StateError(
        'Tried to delete a ScratchSpace which was already deleted');
  exists = false;
  if (_pendingWrites.isNotEmpty) {
    try {
      await Future.wait(_pendingWrites.values);
    } catch (_) {
      // Ignore any errors, we are essentially just draining this queue
      // of pending writes but don't care about the result.
  return tempDir.delete(recursive: true);