删除文件,目录或链接

Android社区 收藏文章

Use the FilesSystemEntity delete() method to delete a file, directory, or symlink. This method is inherited by File, Directory, and Link.

import 'dart:io';

main() async {
  // Create a temporary directory.
  var dir = await Directory.systemTemp.createTemp('my_temp_dir');

  // Confirm it exists.
  print(await dir.exists());

  // Delete the directory.
  await dir.delete();

  // Confirm it no longer exists.
  print(await dir.exists());
}
相关标签

扫一扫

在手机上阅读