moveToTrash method

Future<void> moveToTrash(
  1. String path
)

Move file to trash folder

Implementation

Future<void> moveToTrash(String path) async {
  final sourceFile = File("${getCurrentPath}/$path");
  final trashDir = Directory("${getCurrentPath}/trash");
  if (await trashDir.exists() == false) {
    trashDir.create();
  }
  if (await sourceFile.exists()) {
    sourceFile.renameSync(
      "${trashDir.path}/${sourceFile.path.split('/').last}",
    );
  }
}