delete function

void delete(
  1. String path
)

Implementation

void delete(String path) {
  if (!exists(path)) {
    StatusHelper.failed('The path ${truepath(path)} does not exists.');
  }

  if (isDirectory(path)) {
    StatusHelper.failed('The path ${truepath(path)} is a directory.');
  }

  try {
    File(path).deleteSync();
  } catch (e) {
    StatusHelper.failed(
        'An error occured deleting ${truepath(path)}. Error: $e');
  }
}