delDir static method

Future<Null> delDir(
  1. FileSystemEntity file
)

递归方式删除目录

Implementation

static Future<Null> delDir(FileSystemEntity file) async {
  try {
    if (file is Directory) {
      final List<FileSystemEntity> children = file.listSync();
      for (final FileSystemEntity child in children) {
        await delDir(child);
      }
    }
    await file.delete();
  } catch (e) {
    print(e);
  }
}